How to use the mnemonic.shamir.Shamir function in mnemonic

To help you get started, we’ve selected a few mnemonic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trezor / python-mnemonic / test_shamir.py View on Github external
def shamir_test(l, m, n):
    s = Shamir('english')
    seed = b"Shamir's Secret Sharing Scheme!"[:l]  # take first l characters
    shares = s.split(seed, m, n)
    print('original:', seed)
    print('shares:')
    for i, sh in enumerate(shares):
        print('%2d :' % (i + 1), sh)
    shares = shares[:m]  # take first m shares
    cmb = s.combine(shares)
    print('combined:', cmb)
    if seed == cmb:
        print('TEST OK')
        print()
    else:
        print('TEST FAILED !!!')
        sys.exit(1)