Kryptografia/zajecia2/test-fermata.py

14 lines
248 B
Python
Raw Normal View History

2021-10-27 20:51:05 +02:00
# test fermata
import random
def fermat(k, p):
i = 0
while i < k:
a = random.randint(1, p - 1)
if pow(a, (p - 1), p) == 1:
i = i + 1
else:
return False
return True
print(fermat(10, 79))