Question

The bitcoin wiki says this:


How to create Bitcoin Address

0 - Having a private ECDSA key

18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

1 - Take the corresponding public key generated with it 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

2 - Perform SHA-256 hashing on the public key

600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

but when I run a sha256 on 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

I don't get

600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

What I get is

32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce

what am I doing wrong?

Was it helpful?

Solution

Convert the hex string back to bytes and sha256 the bytes.

Something like that:

>>> hex_string = ('0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6')
>>> hex_data = hex_string.decode('hex')
>>> hashlib.sha256(hex_data).hexdigest()
'600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top