diff --git a/pyseltongue/sharing.py b/pyseltongue/sharing.py index bc1e182..b3231af 100644 --- a/pyseltongue/sharing.py +++ b/pyseltongue/sharing.py @@ -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 @@ -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 diff --git a/test/test_plaintext.py b/test/test_plaintext.py index f99d5cc..5c57977 100644 --- a/test/test_plaintext.py +++ b/test/test_plaintext.py @@ -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' + )