On Sat, Apr 21, 2012 at 14:29, Alan Partis <[email protected]> wrote: > $ echo this |sha256sum > > produces a 32-byte hex string "c18d ..." > > On the other hand, when I pass a 32-byte message buffer containing "this" > followed by 28 nulls as follows: > > Â CryptoPP::SHA256().CalculateDigest(digest, msg, 4) > > I get an output digest containing a 32-byte hex string "1e87 ..."
You mean like this? $ echo this |openssl dgst -sha256 c18d547cafb43e30a993439599bd08321bea17bfedbe28b13bce8a7f298b63a2 $ echo -n this |openssl dgst -sha256 1eb79602411ef02cf6fe117897015fff89f80face4eccd50425c45149b148408 As the last reply pointed out, pay attention to the -n. On my system, the first is hashing 5 bytes: 0x74, 0x68, 0x69, 0x73, 0x0A while the second is hashing the 4 bytes 0x74, 0x68, 0x69, 0x73 HTH, Geoff -- 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.
