To reproduce:
>>> from secretsharing import SecretSharer
>>>
>>> secret = "04bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a"
>>> shares = SecretSharer.split_secret(secret, 2, 3)
>>> recovered = SecretSharer.recover_secret(shares[0:2])
>>> recovered == secret
False
This is due utilitybelt's charset_to_int behavior of dropping leading characters corresponding to a 0 in the charset when it is called on the secret.
If this is not the intended behavior from utilitybelt, a simple fix is to modify charset_to_int and int_to_charset to prepend a 1 to the returned value in order to preserve leading zeroes.
To reproduce:
This is due utilitybelt's
charset_to_intbehavior of dropping leading characters corresponding to a 0 in the charset when it is called on the secret.If this is not the intended behavior from utilitybelt, a simple fix is to modify
charset_to_intandint_to_charsetto prepend a 1 to the returned value in order to preserve leading zeroes.