python-rsa-implementation/tests.py
2025-01-23 17:57:15 +01:00

16 lines
344 B
Python

import lib.rsa as rsa
import lib.arithmetics as arithm
import lib.miller_rabin as miller
for i in range(100):
for j in range(100):
assert arithm.modpow(i, j, 20) == pow(i, j, 20)
for i in range(3, 100):
if miller.is_prime(i): print(i)
e, d, n = rsa.get_keys(2048)
c = rsa.encrypt(22, e, n)
m = rsa.decrypt(c, d, n)
print(m)