Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Digest sha256 returns gibberish

by Athanasius (Archbishop)
on Aug 08, 2012 at 04:51 UTC ( [id://986134]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Digest sha256 returns gibberish
in thread Digest sha256 returns gibberish

Using the online SHA-256 hash calculator at http://www.xorbin.com/tools/sha256-hash-calculator, the hash of:

800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D

is given as:

e2e4146a36e9c455cf95a4f259f162c353cd419cc3fd0e69ae36d7d1b6cd2c09

which is the exact result returned by Digest::SHA::sha256_hex:

This is a hexdigest->e2e4146a36e9c455cf95a4f259f162c353cd419cc3fd0e69a +e36d7d1b6cd2c09

Where did you get the expected result beginning 81477...?

Update 1: Same result at http://hash.online-convert.com/sha256-generator.

Update 2: ++aitap for the solution below.

Athanasius <°(((><contra mundum

Replies are listed 'Best First'.
Re^4: Digest sha256 returns gibberish
by invalid_logic (Initiate) on Aug 08, 2012 at 05:09 UTC
    This is what I'm following: https://en.bitcoin.it/wiki/Wallet_import_format

    The source code for the hex creation (see 'ToString') is here:

    https://github.com/bitcoin/bitcoin/blob/master/src/bignum.h

    As I'm just learning to program, I'm having trouble following the C++ code so instead trying to follow the wiki process. If they are concatenating the int(64) with something else, it's difficult for me to tell.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://986134]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 03:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found