Monday, November 25, 2024

mnemonic seed – python “pbkdf2_hmac” perform does not return similar as Ian Coleman BIP39 software. Why?

I’m making an attempt to go from a BIP39 phrase to Seed to xprv root key. I’ve the next BIP39 phrase:

“want provide pet imitate pink banana as a result of whale letter thought paintings loud”

which in accordance with the Ian Coleman software returns a Seed of

“af0dc2290ec62618dd11686d3fb7201dc3a57dcc3129713272cd1fe75002d963db048cfda84da6cc1762c027b49b1a76e2d3e408f589c7acfca681e506a03aff”

and a xprv of

“xprv9s21ZrQH143K2Xszf61JSrkqT2cgXVbhKcu3YcfKmL5gYquAsMTFTwZ6NDqjMzPkCk4k9MkqwQKqyfxH7K3RCXdRZ7poUFZw3h5mEu9kCEW”

I exploit the next code to attempt to emulate this:

from hashlib import pbkdf2_hmac #import for going BIP39 phrases to key

    def BIP39_to_hash():
    
        mnemonictohash="want provide pet imitate pink banana as a result of whale letter thought paintings loud"
        a512string = pbkdf2_hmac('sha512',bytes(mnemonictohash,'ascii'), bytes.fromhex(''), 2048, dklen=512) #bytesfromhex is the salt (clean), 2048 is iterations
        print(binascii.hexlify(a512string)) #as Byte String transformed to hex
    
    BIP39_to_hash

nevertheless this returns “b’1acefb42123af6019fe4487aef8095b3879a028f313bae10b83fd72f8972fed7cc2502a8a6f0c1b99c2fb55efebcbd79258808c0c026dbfa282fa0b62db827da5fcea3cb6d71a31c41b6324e2b00cdc4e270572da5683d05201e89413fa1aded294be883635e6de3c84c87617971c84a17364c727109d6de3e82b31bc0a49be3e93f40fc50cd2b8121589ddfd44c338b98ef76b1408a74e2f4a521087e8dfb3112ffb12fa2f29cd7c6abc311b25c3d0278c836249d01525ecf39faa3ca6a4fc2513cb3ae6af70552179aee8f755ed6be00afce1303452dd8008bfdcd289849df2ce304807a9f7bfc1040927b3aca60390c05132cb12c00dd9b33e165f1ced6157eeb60253979af0922a1794427efbf27d8810e11bf31b5a41bdad73dbd85e200ef982ff0ce2157f0cdcd0b35e069c41a850459f04752654119590f86b528544b616b24798e1a179853530491b27b21d8bfde33575679ba16afde0b40b95a6ab112fbe68a8df11ba1b8d419251b5c85121a0f2deeea43b767d720df730018f4fd8616d3f787b196cc1cd61f7a0eef0149453a599193bdf51af65c3ac5b7b469bb7ab9fb8d837a727979b6d6de079e1db7eb02eee03b19e719615b54e5bf0be5dade7fd022aff5fd0389ce37b5ca69e8172c2420cb9b1869d4eb3c083a06096bd3d334ab223efd3f1eb8d301ce89a5685bbbc3fa5cba4a26c696eb55e660367c39′”

what am I lacking?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles