It seems to me that they should, but my simple program to implement
.CalculateDigest() does not provide the same digest result.
Can anyone help me understand why that is?
Thanks.
_______________________________________________________
Alan Partis
thundernet development group
> --
> You received this message because you are subscribed to the "Crypto++ Users" Google Group.
> To unsubscribe, send an email to cryptopp-user...@googlegroups.com.
> More information about Crypto++ and this group is available at http://www.cryptopp.com.
> Is it anything like proverbial
> echo "string" | sha256sum_prog
> echo -n "string" | sha256sum_prog
from the command line:
$ 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 ..."
I frankly have been expecting to see the same hex string come from both.
I'm still trying to track down the source for sah256_stream used by the
GNU coreutils to produce the sha256sum program, but no luck yet. I'm
guessing I may find my answer there, unless someone here can shed some
light.
My expectation is that the SHA256 hash algorithm is a deterministic
standard i.e. no matter who does it, the SHA256 hash for the string "this"
should always produce the same digest by definition. I'm just trying to
validate my simple little SHA256 hash program by comparing its resulting
digest with the output from sha256sum. Given that they differ, one of the
following MUST be true:
1. they SHOULDN'T match for some reason (I'm hoping someone here can
explain)
2. my simple program is an incorrect implementation of
SHA256.CalculateDigest()
-ap
At least that answers my question: there should NOT be any difference
between the output of sha256sum and the Cryptopp::SHA256().CalculateDigest
function. Sanity has been restored.
-ap