Skip to content

Commit

Permalink
expand readme - include custom formats
Browse files Browse the repository at this point in the history
  • Loading branch information
shea256 committed May 29, 2014
1 parent 8c81786 commit f97fed4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ Tools for sharing secrets (like Bitcoin private keys), using shamir's secret sha

>>> points_to_secret_int(shares[0:2])
88985120633792790105905686761572077713049967498756747774697023364147812997770L

### Custom formats

#### Splitting into shares

>>> from secretsharing import SecretSharer, base64_chars, base16_chars
>>> sharer = SecretSharer(secret_charset=base16_chars, share_charset=base64_chars)
>>> shares = sharer.split_secret("c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a", 2, 3)
['B-JpxCTUQ9D+q93JglQM9yRinI2Cyxe92FTBSYa93ppfY', 'C-HAmR0pjHuHwL4rozXnFY05ysIJVqtf3pob1HCMaaZUm', 'D-EXbhV+1SYQ1Z6NxBfBM/YQ+PaP4j8B5N92X1pa9LJJ0']

#### Recovering from shares

>>> sharer.recover_secret(shares[0:2])
'c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a'
2 changes: 1 addition & 1 deletion secretsharing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
__version__ = '0.2.0'

from .sharing import *
from .charset import charset_to_int, int_to_charset
from .charset import *
5 changes: 5 additions & 0 deletions secretsharing/charset.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def change_charset(s, original_charset, target_charset):
output_string = int_to_charset(intermediate_integer, target_charset)
return output_string

""" Base16 includes numeric digits and the letters a through f. Here,
we use the lowecase letters.
"""
base16_chars = string.hexdigits[0:16]

""" The Base58 character set allows for strings that avoid visual ambiguity
when typed. It consists of all the alphanumeric characters except for
"0", "O", "I", and "l", which look similar in some fonts.
Expand Down

0 comments on commit f97fed4

Please sign in to comment.