#!/usr/bin/env python3 from rfc1982_serial_number import Serial from random import randint from subprocess import run def test(n, i1, i2): cmd = ("./rfc1982_serial_number.py", str(i1), str(i2)) print(f"\nTest: {n}: {cmd[0]} {cmd[1]} {cmd[2]}") run(cmd) for n in range(100): test(n, randint(0, Serial.modulus - 1), randint(0, Serial.modulus - 1)) for n in range(10): t = randint(0, Serial.modulus - 1) test(n, t, t ^ (Serial.modulus >> 1)) for n in range(10): t = randint(0, Serial.modulus - 1) test(n, t, (t + Serial.modulus - 1) & (Serial.modulus - 1))