czechbol/mathcrypto

Multiplicative group generators

Closed this issue · 2 comments

I think there is an error in the logic of computing element orders.

>>> import mathcrypto
>>> g = mathcrypto.MultiplicativeGroup(7)
>>> g.get_element_order(2)
6

however from

>>> for i in range(g.order):
>>>     print(2**i % g.mod)
1
2
4
1
2
4

we can see that 2's order is just three, not six.

>>> import mathcrypto
>>> mathcrypto.MathFunctions.factorize(6)
6

clearly doesn't work, 6 = 2*3. This function doesn't work for any numbers under 10.

Resolved by e2c3019