I am using hash.Update to iterate over a vector to calculate the hash of
the container. Is there a better way to do this?
std::string digest;
SHA256 hash;
for(auto str: stringVector) {
hash.Update((const byte*)str.data(), str.size());
}
digest.resize(hash.DigestSize());
hash.Final((byte*)&digest[0]);
On Wednesday, 2 February 2022 at 12:19:25 UTC-5 Devharsh Trivedi wrote:
> I am trying to calculate SHA256 digest for entire string vector like this:
>
> byte digest[SHA256::DIGESTSIZE];
> SHA256().CalculateDigest(digest, (const byte*)stringVector.data(),
> stringVector.size());
>
> What is the correct way to calculate hash of entire vector?
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/cryptopp-users/695099fe-6de7-4647-8842-4e8ea313d4f3n%40googlegroups.com.