Skip to content

Commit

Permalink
corrected comments; run time complexity info.
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeshc authored Nov 24, 2016
1 parent ce89fba commit fc3c0ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pollardRhoAttack.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def gcd(a, b):
""" Returns gcd(a, b) """
""" Complexity: O( log(N) ) """
""" Complexity: O( log^3(N) ) """
if a > b:
return gcd(b, a)

Expand All @@ -27,7 +27,7 @@ def gcd(a, b):

def moduloPower(a, i, N):
""" Returns a**i (mod N) """
""" Complexity: O( log(B) * log(N) ) """
""" Complexity: O( log(B) * log^2(N) ) """
val = 1
while i > 0:
if i % 2:
Expand All @@ -40,7 +40,7 @@ def moduloPower(a, i, N):

def pollardRhoAttack(a, N, B):
""" Implementation of Pollard's Rho - 1 Attack """
""" Worst Case Complexity: O( B * log(B) * log(N) ) """
""" Worst Case Complexity: O( ( B * log(B) + log(N) ) * log^2(N) ) """

# computing a**(B!) (mod N)
for i in xrange(2, B + 1):
Expand Down Expand Up @@ -69,4 +69,4 @@ def pollardRhoAttack(a, N, B):
B = int( sys.argv[2] )

if not pollardRhoAttack(a, N, B):
print MSG[CODE_FAIL]
print MSG[CODE_FAIL]

0 comments on commit fc3c0ca

Please sign in to comment.