def mnemonic_to_seed(cls, mnemonic, passphrase): """ Electrum format """ PBKDF2_ROUNDS = 2048 mnemonic = cls.normalize_text(mnemonic) passphrase = cls.normalize_text(passphrase or '', is_passphrase=True) return hashlib.pbkdf2_hmac('sha512', mnemonic.encode('utf-8'), b'electrum' + passphrase.encode('utf-8'), iterations=PBKDF2_ROUNDS)
def get_mnemonic(seed): return ' '.join(mnemonic.encode(seed))
def test_encode(self): self.assertEqual(mnemonic.encode(seed), mnem)