summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Laurie von Massenbach <felix@erbridge.co.uk>2014-05-27 03:13:33 +0200
committerBen Laurie <ben@links.org>2014-06-01 16:31:26 +0200
commit8a120852938247f53f0eb793932ef7b13db9f577 (patch)
tree3c4735e0214de067baa50c198103af5312fa2b5d
parentGenerate safe primes not divisible by 3, 5 or 7. (diff)
downloadopenssl-8a120852938247f53f0eb793932ef7b13db9f577.tar.xz
openssl-8a120852938247f53f0eb793932ef7b13db9f577.zip
Add python script to generate the bits needed for the prime generator.
-rw-r--r--tools/primes.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/primes.py b/tools/primes.py
new file mode 100644
index 0000000000..c4be13baae
--- /dev/null
+++ b/tools/primes.py
@@ -0,0 +1,21 @@
+primes = [2, 3, 5, 7]
+safe = True
+
+muliplier = 1
+for p in primes:
+ muliplier *= p
+
+offsets = []
+for x in range(3, muliplier + 3, 2):
+ prime = True
+ for p in primes:
+ if not x % p or (safe and not ((x - 1) / 2) % p):
+ prime = False
+ break
+
+ if prime:
+ offsets.append(x)
+
+print(offsets)
+print(len(offsets))
+print(muliplier)