First commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from Cryptotools.Groups.galois import Galois
|
||||
import matplotlib.pyplot as plt # pip install numpy==1.26.4
|
||||
|
||||
|
||||
def operation(a, b, n):
|
||||
return (a ** b) % n
|
||||
|
||||
q = 13
|
||||
g = Galois(q, operation)
|
||||
add = g.add()
|
||||
div = g.div()
|
||||
mul = g.mul()
|
||||
sub = g.sub()
|
||||
g.check_closure_law('+')
|
||||
g.check_closure_law('*')
|
||||
g.check_closure_law('-')
|
||||
g.check_closure_law('/')
|
||||
|
||||
print("Addition")
|
||||
g.printMatrice(add)
|
||||
print("Division")
|
||||
g.printMatrice(div)
|
||||
print("Multiplication")
|
||||
g.printMatrice(mul)
|
||||
print("Substraction")
|
||||
g.printMatrice(sub)
|
||||
|
||||
|
||||
print("Primitives root")
|
||||
print(g.primitiveRoot(), end="\n\n")
|
||||
|
||||
#print("Identity elements")
|
||||
g.check_identity_add()
|
||||
g.check_identity_mul()
|
||||
Reference in New Issue
Block a user