First commit

This commit is contained in:
2026-01-11 09:19:22 +01:00
commit 50f7b1159e
108 changed files with 11791 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
from Cryptotools.Groups.cyclic import Cyclic
from random import choice
def operation(a, b, n):
return (a ** b) % n
n = 19
g = list()
for i in range(1, n):
g.append(i)
print(f"n = {n}")
print(f"G = {g}")
cyclic = Cyclic(g, n, operation)
cyclic.generator()
generators = cyclic.getGenerators()
print(f"All generators: {generators}")
e = choice(generators)
z = list()
for a in range(1, n):
res = operation(e, a, n)
z.append(res)
z = sorted(z)
if z == g:
print(f"Working with the generator {e}")