From a0c74b31f50d872d4acc63e96a72308f1e343c90 Mon Sep 17 00:00:00 2001 From: Tatiana Bradley Date: Thu, 16 Oct 2014 19:10:29 -0700 Subject: [PATCH] Create bruteforcelog.py --- primecurves/primecurves/bruteforcelog.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 primecurves/primecurves/bruteforcelog.py diff --git a/primecurves/primecurves/bruteforcelog.py b/primecurves/primecurves/bruteforcelog.py new file mode 100644 index 0000000..9b7a5f9 --- /dev/null +++ b/primecurves/primecurves/bruteforcelog.py @@ -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