mirror of
https://github.com/billbuchanan/appliedcrypto.git
synced 2026-02-21 11:18:02 +00:00
Update c_02.py
This commit is contained in:
@@ -1,22 +1,19 @@
|
||||
import sys
|
||||
import random
|
||||
|
||||
p=11
|
||||
|
||||
def getG(p):
|
||||
|
||||
for x in range (1,p):
|
||||
rand = x
|
||||
exp=1
|
||||
next = rand % p
|
||||
rand = x
|
||||
exp=1
|
||||
next = rand % p
|
||||
|
||||
while (next <> 1 ):
|
||||
next = (next*rand) % p
|
||||
exp = exp+1
|
||||
|
||||
while (next != 1 ):
|
||||
next = (next*rand) % p
|
||||
exp = exp+1
|
||||
if (exp==p-1):
|
||||
print (rand)
|
||||
|
||||
if (exp==p-1):
|
||||
print rand
|
||||
|
||||
print getG(p)
|
||||
print (getG(p))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user