def test_sign_verify(): from unittesting import test_sign_verify test_sign_verify("signaturetest", generate_keypair, sign, verify, iterations=10000, message_size=64)
#q <- qr * k2 mod P #e <- (pie * k3) mod P # ((k1m mod P) mod k1) * k2 # ((k1m mod P) - ((k1m mod P) mod k1)) * k3 # (x mod k1) * k2 # (x - (x mod k1)) * k3 # y k2 # (x - y) * k3 # k3x - k3y # k1k2r + k2e1 # (pq + e2 - k1r + e1) * k3 # def sign(message, private_key, n=N): pi, ri, p = private_key pie_qr = (pi * message) % n qr = pie_qr % pi pie = pie_qr - qr return (qr * ri) % n, (pie * p) % n def test_sign_verify(): from unittesting import test_sign_verify test_sign_verify("signaturetest", generate_keypair, sign, verify, iterations=10000, message_size=64) if __name__ == "__main__": test_sign_verify()
def unit_test(): from unittesting import test_key_exchange, test_sign_verify test_key_exchange("cutemodulus", generate_keypair, encapsulate_key, recover_key, iterations=10000) test_sign_verify("cutemodulus", generate_keypair, sign, verify, iterations=10000, message_size=P_SIZE - 4)