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.