def get_keys(mnemonic, email, password): salt = unicodedata.normalize( "NFKD", (email + password).decode("utf8")).encode("utf8") seed = bitcoin.mnemonic_to_seed(mnemonic, salt) pk, sk = pysodium.crypto_sign_seed_keypair(seed[0:32]) pkh = blake2b(pk, 20).digest() pkhb58 = bitcoin.bin_to_b58check(pkh, magicbyte=434591) return (sk, pk, pkh, pkhb58)
def get_master_key(): words = ' '.join(get_password().split()) try: a = bitcoin.words_verify(words) except Exception as e: print(e) a = False if (not a): q = user_input( "Warning! Mnemonic does not verify as a string of bip39 english space-seperated words! continue? [y/N]", 'y') seed = bitcoin.mnemonic_to_seed(words) master_key = bitcoin.bip32_master_key(seed) return master_key
def get_master_key(): words=' '.join(get_password().split()) try: a = bitcoin.words_verify(words) except Exception as e: print(e) a = False if not a: q = user_input( "Warning! Mnemonic does not verify as a string of bip39 english " + "space-seperated words! continue? [y/N]", 'y') seed = bitcoin.mnemonic_to_seed(words) master_key = bitcoin.bip32_master_key(seed) return master_key
def check(address, mnemonic, email, password): salt = unicodedata.normalize("NFKD", (email + password)).encode("utf8") try: seed = bitcoin.mnemonic_to_seed(mnemonic.encode(), salt) except: return -1 pk, sk = pysodium.crypto_sign_seed_keypair(seed[0:32]) pkh = blake2b(pk, 20).digest() decrypted_address = tezos_pkh(pkh) if address == decrypted_address: return 1 else: return 0
import bitcoin from bitcoin.deterministic import bip32_harden as h mnemonic = 'saddle observe obtain scare burger nerve electric alone minute east walnut motor omit coyote time' seed = bitcoin.mnemonic_to_seed(mnemonic) mpriv = bitcoin.bip32_master_key(seed) accountroot = mpriv accountroot = bitcoin.bip32_ckd(accountroot, h(44)) accountroot = bitcoin.bip32_ckd(accountroot, h(0)) accountroot = bitcoin.bip32_ckd(accountroot, h(0)) for i in range(19): dkey = bitcoin.bip32_descend(accountroot, 0, i) print(bitcoin.privtoaddr(dkey))
import bitcoin from bitcoin.deterministic import bip32_harden as h mnemonic='saddle observe obtain scare burger nerve electric alone minute east walnut motor omit coyote time' seed=bitcoin.mnemonic_to_seed(mnemonic) mpriv=bitcoin.bip32_master_key(seed) accountroot=mpriv accountroot=bitcoin.bip32_ckd(accountroot,h(44)) accountroot=bitcoin.bip32_ckd(accountroot,h(0)) accountroot=bitcoin.bip32_ckd(accountroot,h(0)) for i in range(19): dkey=bitcoin.bip32_descend(accountroot,0,i) print(bitcoin.privtoaddr(dkey))