Skip to content

Commit

Permalink
Create bruteforcelog.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tatianab committed Oct 17, 2014
1 parent 8e5777c commit a0c74b3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions primecurves/primecurves/bruteforcelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## /file bruteforcelog.py
## /author Tatiana Bradley
## /brief Function to compute elliptic curve discrete logs by
## brute force.

from primecurve import *

# Finds n where n * base = point
def bruteForceLog(base, point):
modulus = base.curve.prime
prev = PrimePoint.inf()
for i in range(1, modulus ** 2):
current = prev + base
if (current == point):
return i
prev = current

0 comments on commit a0c74b3

Please sign in to comment.