diff --git a/unit05_key_exchange/src/c_02.py b/unit05_key_exchange/src/c_02.py index 7c8caad..0d19eb8 100644 --- a/unit05_key_exchange/src/c_02.py +++ b/unit05_key_exchange/src/c_02.py @@ -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))