How to use the mnemonic.secretsharing.secret_int_to_points 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 / mnemonic / shamir.py View on Github external
def split(self, data, m, n):
        if not len(data) in self.primes.keys():
            raise Exception('Unknown data length')
        if m < 2 or m > 15:
            raise Exception('Invalid M provided')
        if n < 2 or n > 15:
            raise Exception('Invalid N provided')
        prime = self.primes[len(data)]
        s = secret_int_to_points(int(binascii.hexlify(data), 16), m, n, prime)
        s = ['%x%x%s' % (m, x[0], ('%x' % x[1]).zfill(len(data) * 2)) for x in s]
        return [self.mnemo.to_mnemonic(binascii.unhexlify(x)) for x in s]