diff --git a/hashing/sha256.cpp b/hashing/sha256.cpp index 5d4f29dcc..03ec158ea 100644 --- a/hashing/sha256.cpp +++ b/hashing/sha256.cpp @@ -182,17 +182,14 @@ std::array compute_hash(const std::string &input) { * @return std::string Final hash value */ std::string hash_to_string(const std::array &hash) { - std::string result; + std::stringstream ss; for (size_t i = 0; i < 8; ++i) { for (size_t j = 0; j < 4; ++j) { uint32_t byte = (hash[i] >> (24 - j * 8)) & 0xFF; - std::stringstream ss; ss << std::hex << std::setfill('0') << std::setw(2) << byte; - result += ss.str(); } } - - return result; + return ss.str(); } /**