Bitcoin Forum
September 21, 2018, 01:12:50 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: WIF checksum  (Read 311 times)
evanuz
Newbie
*
Offline Offline

Activity: 61
Merit: 0


View Profile
July 27, 2017, 06: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
1537535570
Hero Member
*
Offline Offline

Posts: 1537535570

View Profile Personal Message (Offline)

Ignore
1537535570
Reply with quote  #2

1537535570
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1537535570
Hero Member
*
Offline Offline

Posts: 1537535570

View Profile Personal Message (Offline)

Ignore
1537535570
Reply with quote  #2

1537535570
Report to moderator
1537535570
Hero Member
*
Offline Offline

Posts: 1537535570

View Profile Personal Message (Offline)

Ignore
1537535570
Reply with quote  #2

1537535570
Report to moderator
DannyHamilton
Legendary
*
Offline Offline

Activity: 2198
Merit: 1373



View Profile
July 27, 2017, 07: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)

evanuz
Newbie
*
Offline Offline

Activity: 61
Merit: 0


View Profile
July 27, 2017, 09: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?

evanuz
Newbie
*
Offline Offline

Activity: 61
Merit: 0


View Profile
July 27, 2017, 09:54:53 PM
 #4

Oh i find out it has to be converted to hex Cheesy Thx anyway
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!