Skip to content

Commit

Permalink
modify charset used to solve utility belt issue; closes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
nginsburg committed Sep 28, 2021
1 parent 1464b70 commit ca467ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyseltongue/sharing.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class SecretSharer():
character set of the secrets and the character set of the shares that
it expects to be dealing with.
"""
secret_charset = string.hexdigits[0:16][::-1]
share_charset = string.hexdigits[0:16][::-1]
secret_charset = string.hexdigits[0:17][::-1]
share_charset = string.hexdigits[0:17][::-1]

def __init__(self):
pass
Expand All @@ -114,14 +114,14 @@ def recover_secret(cls, shares):
class HexToHexSecretSharer(SecretSharer):
""" Standard sharer for converting hex secrets to hex shares.
"""
secret_charset = string.hexdigits[0:16][::-1]
share_charset = string.hexdigits[0:16][::-1]
secret_charset = string.hexdigits[0:17][::-1]
share_charset = string.hexdigits[0:17][::-1]

class PlaintextToHexSecretSharer(SecretSharer):
""" Good for converting secret messages into standard hex shares.
"""
secret_charset = string.printable[::-1]
share_charset = string.hexdigits[0:16][::-1]
share_charset = string.hexdigits[0:17][::-1]

class BitcoinToB58SecretSharer(SecretSharer):
""" Good for converting Bitcoin secret keys into shares that can be
Expand Down
9 changes: 9 additions & 0 deletions test/test_plaintext.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ def test_zero_leading_ascii_to_hex_sharing(self):
self.split_and_recover_secret_alt_parts(
3, 5, '0B4A30EEFEBA6783EA68F79AD5DC85E4DDCD83D4'
)

def test_f_leading_ascii_to_hex_sharing(self):
"""Test leading 0 issue"""
self.split_and_recover_secret(
3, 5, 'f6b00c143f637e83f0eb2366888d1c02878dc32366148648f08fea67c8704cdd'
)
self.split_and_recover_secret_alt_parts(
3, 5, 'f6b00c143f637e83f0eb2366888d1c02878dc32366148648f08fea67c8704cdd'
)

0 comments on commit ca467ce

Please sign in to comment.