From c07b429d22a2b75d8ea0d08a785e4ea17a5b546f Mon Sep 17 00:00:00 2001 From: Chong Yeol Nah Date: Mon, 15 May 2023 17:39:05 -0700 Subject: [PATCH] sha224: throw away the last 32 bits --- sha256.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sha256.cpp b/sha256.cpp index 8f0857d..80674ea 100644 --- a/sha256.cpp +++ b/sha256.cpp @@ -374,7 +374,11 @@ std::string SHA256::getHash() // convert to hex string std::string result; result.reserve(2 * HashBytes); +#ifdef SHA2_224_SEED_VECTOR + for (int i = 0; i < HashBytes - 4; i++) +#else for (int i = 0; i < HashBytes; i++) +#endif { static const char dec2hex[16+1] = "0123456789abcdef"; result += dec2hex[(rawHash[i] >> 4) & 15];