3
(Note: I'm using http://www.royalforkblog.com/2014/08/11/graphical-address-generator/ (use "bitcoin" as the phrase for generating the private key)
I'm trying to take the first step in going from a publickey to an address.
For example, if this is my public key:
publickey = 02218AD6CDC632E7AE7D04472374311CEBBBBF0AB540D2D08C3400BB844C654231
This should be the result of the next step:
ripemd160(sha256(publickey)) = 5238C71458E464D9FF90299ABCA4A1D7B9CB76AB
However, when I try to do this in python, I fail to get the same result:
>>> hashlib.new('sha256', '02218AD6CDC632E7AE7D04472374311CEBBBBF0AB540D2D08C3400BB844C654231').hexdigest()
'6e28eefe40e5855ed8cdf0599ec12e52f73a5b222c84ba957b4dcdd2d8a9cf2a'
>>> hashlib.new('ripemd160', '6e28eefe40e5855ed8cdf0599ec12e52f73a5b222c84ba957b4dcdd2d8a9cf2a').hexdigest()
'e607ff4fa71ef33ca357415e3d2f781c4cedacc3'
Where am I going wrong when using sha256 and ripemd160 in my python code?
Furthermore, I cannot recreate the hash results using SHA256 or RIPEMD160 from the steps outlined on the Bitcoin wiki either: https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
– inersha – 2015-04-22T12:46:47.557inersha, if any response below has completely answered your question, please consider Accepting it. If not, please consider commenting on why it is incomplete so that it can be improved. More info on Accepting answers can be found here: http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work#5235
– Christopher Gurnee – 2015-04-25T11:48:54.330