Open RezApp opened 6 years ago
This is indeed an issue. The following code will not give the correct hash for the second doFinal of text1. Only the first doUpdate result in the correct has, in this case for text2. Is it possible to fix that?
hasher.doUpdate(text2.c_str(), text2.length());
hasher.doFinal(hash2);
printHash(hash2);
hasher.doUpdate(text1.c_str(), text1.length());
hasher.doFinal(hash1);
printHash(hash1);
Thanks!
I have created a pull request with the solution to this problem. Hope you like it :).
Please consider a reset function for sha256, because if you doUpdate and then doFinal twice or more for the same inputs your hashes are different.