I’m trying to go from Seed to xprv root key in BIP39 syntax. I have the following BIP39 syntax:
“The whale lettering thought art work is noisy, so the dog prefers to imitate the pink banana”
According to Ian Coleman’s tool, it returns a Seed.
“af0dc2290ec62618dd11686d3fb7201dc3a57dcc3129713272cd1fe75002d963db048cfda84da6cc1762c027b49b1a76e2d3e408f589c7acfca681e506a03aff”
And xprv
“xprv9s21ZrQH143K2Xszf61JSrkqT2cgXVbhKcu3YcfKmL5gYquAsMTFTwZ6NDqjMzPkCk4k9MkqwQKqyfxH7K3RCXdRZ7poUFZw3h5mEu9kCEW”
Let’s emulate this using the following code.
from hashlib import pbkdf2_hmac #import for going BIP39 words to key
def BIP39_to_hash():
mnemonictohash="prefer offer puppy imitate pink banana because whale letter thought artwork loud"
a512string = pbkdf2_hmac('sha512',bytes(mnemonictohash,'ascii'), bytes.fromhex(''), 2048, dklen=512) #bytesfromhex is the salt (blank), 2048 is iterations
print(binascii.hexlify(a512string)) #as Byte String converted to hex
BIP39_to_hash
But this returns “b””.
What am I missing?