Author

Topic: WIF checksum (Read 361 times)

newbie
Activity: 60
Merit: 0
July 27, 2017, 04:54:53 PM
#4
Oh i find out it has to be converted to hex Cheesy Thx anyway
newbie
Activity: 60
Merit: 0
July 27, 2017, 04:43:41 PM
#3
Since the string you have is ALREADY base58check encoded, and you want to decode it back to its original bytes, try using:

enco=base58.b58decode_check(hexwif)

instead of

enco=base58.b58encode_check(hexwif)


Thanks for the reply

I have tried it like this:

Code:
import base58
hexwif=str.encode("5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ")
enco=base58.b58decode_check(hexwif)

And the output of enco is:

Code:
>>> enco
b"\x80\x0c(\xfc\xa3\x86\xc7\xa2'`\x0b/\xe5\x0b|\xae\x11\xec\x86\xd3\xbf\x1f\xbeG\x1b\xe8\x98'\xe1\x9dr\xaa\x1d"

Which looks more similar to what i should get but some parts are different is it because of some encoding i should convert it again?

legendary
Activity: 3472
Merit: 4801
July 27, 2017, 02:36:07 PM
#2
Since the string you have is ALREADY base58check encoded, and you want to decode it back to its original bytes, try using:

enco=base58.b58decode_check(hexwif)

instead of

enco=base58.b58encode_check(hexwif)
newbie
Activity: 60
Merit: 0
July 27, 2017, 01:55:02 PM
#1
Hey, i am trying to make a validation of WIF (Wallet Import Format).

Following the wiki: https://en.bitcoin.it/wiki/Wallet_import_format

In step two, i have to Convert it to a byte string using Base58Check encoding

I am using python , therefore:

Code:
import base58
hexwif=str.encode("5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ")
enco=base58.b58encode_check(hexwif)
data=bytes(enco,"ascii")
l=list(data)

If i print data it gives me this output

[75, 120, 109, 118, 51, 117, 90, 90, 107, 69, 50, 100, 99, 89, 107, 65, 115, 113, 97, 99, 115, 90, 76, 70, 100, 82, 103, 52, 87, 102
, 97, 109, 66, 109, 115, 53, 84, 101, 120, 87, 111, 97, 68, 71, 114, 109, 102, 75, 105, 119, 82, 82, 98, 54, 87, 114, 89, 104, 69, 7
1, 117, 117, 90, 81, 53, 49, 103, 99, 80, 109, 101, 107, 104, 71, 107]

Which is different from what i should obtain according to the wiki.

Can somebody help me??

Thanks
Jump to: