On Tuesday, March 17, 2015 at 5:44:18 PM UTC-4, JF Jobidon wrote:
>
> Hi
> I use c++ with crypto++ to generate a sha256 hash from this string:
> "800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D"
> I have the same result as
> http://www.xorbin.com/tools/sha256-hash-calculator :
>
> E2E4146A36E9C455CF95A4F259F162C353CD419CC3FD0E69AE36D7D1B6CD2C09
>
> but the problem is I try to obtain a private key for the Bitcoin protocol:
>
> when I use the *Bitcoin* Explorer (*bx*) command line tool.
>
> I have a different result:
>
> > bx sha256  
> 800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D
> 8147786c4d15106333bf278d71dadaf1079ef2d2440a4dde37d747ded5403592
>

        string message = 
"800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D";
        string digest;
        
        SHA256 hash;
        StringSource ss(message, true, new HexDecoder(new HashFilter(hash, 
new HexEncoder(new StringSink(digest)))));
        
        cout << "Digest: " << digest << endl;

Results in:

$ ./cryptopp-test.exe
Digest: 8147786C4D15106333BF278D71DADAF1079EF2D2440A4DDE37D747DED5403592 

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to