python - SHA256 doesn't yield same result -


i'm following on this tutorial , in part 2 (picture below) shows sha256 yields result different when ran python code:

the string is: 0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6

while tutorial sha256 comes to: 600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408

my short python shows:

sha_result = sha256(bitconin_addresss).hexdigest().upper() print sha_result  32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce 

in fact, online sha256 shows same python result; missing here something?

enter image description here

you're hashing string when you're supposed hashing bytes represented string.

>>> hashlib.sha256('0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6'.decode('hex')).hexdigest().upper() '600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408' 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -