Skip to content

Commit

Permalink
add another prime to the list of primes, update the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shea256 committed May 27, 2014
1 parent 794b129 commit 3681504
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Tools for sharing secrets (like Bitcoin private keys), using shamir's secret sha
>>> shares = sharer.split_secret(secret, 3, 5)
['1-2253a55f531283ea44e6616fb6edae5ad78edbbb8c10225e38c6f474fa76df64', '2-7175dcede9247604dd3ed59cc7f95c975f6d1432dc8ed26d2a5b3a5d4b058b28', '3-b22271cb80ff73b5886334e3bfd939987330e875d28304b0ae6c78f4c68f9cad', '4-e45963f81aa37cfc46537f449e8d455e12da58846decb928c4fab03b6d1513f3', '5-81ab373b61091d9170fb4bf64157fe83e69645eaecbefd56e05e0313e95efd1']

#### Recovering a hex secret from hex shares
#### Recovering a hex secret from shares

>>> sharer.recover_secret(shares[0:3])
'c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a'
Expand All @@ -22,10 +22,13 @@ Tools for sharing secrets (like Bitcoin private keys), using shamir's secret sha

>>> secret = "correct horse battery staple"
>>> sharer = PlaintextToHexSecretSharer()
>>> shares = sharer.split_secret(secret, 3, 5)
>>> shares = sharer.split_secret(secret, 2, 3)
['1-7da6b11af146449675780434f6589230a3435d9ab59910354205996f508b8d0d', '2-fb4d6235e28c892cea70367c15ec3cbfed4cf4a417bd01e9812980f3ac97ddc8', '3-78f41350d3d2cdc35f6868c3357fe74f37568bad79e0f39dc04d687808a42d5a']

#### Splitting up a Bitcoin private key into reliably transcribable shares

>>> secret = "5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS"
>>> sharer = BitcoinSecretSharer()
>>> shares = sharer.split_secret(secret, 3, 5)
>>> shares = sharer.split_secret(secret, 2, 3)
['b-aweuzkm9jmfgd7x4k595bzcm3er3epf4dprfwzpprqa3exbuocs9byn4owfuqbo', 'n-btetgqqu8doacarsbyfdzpyycyj6gfdeaaxrpfx33pdjk4ou1d5owjdmdi1iegm9', 'd-njh33f14q7smucmh8iq8uaewc8mzub3mzptrwsegfiz3hc1fozkkjtguc4trh6sq']

6 changes: 4 additions & 2 deletions secretsharing/primes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def calculate_mersenne_primes():
return primes

SMALLEST_257BIT_PRIME = (2**256 + 297)
SMALLEST_321BIT_PRIME = (2**320 + 27)
SMALLEST_385BIT_PRIME = (2**384 + 231)
MERSENNE_PRIMES = calculate_mersenne_primes()
STANDARD_PRIMES = MERSENNE_PRIMES + [SMALLEST_257BIT_PRIME, SMALLEST_385BIT_PRIME]
STANDARD_PRIMES = calculate_mersenne_primes() + [
SMALLEST_257BIT_PRIME, SMALLEST_321BIT_PRIME, SMALLEST_385BIT_PRIME
]
STANDARD_PRIMES.sort()

def get_large_enough_prime(batch):
Expand Down

0 comments on commit 3681504

Please sign in to comment.