From f8f2df7001617648cfe9e5b7d277e887933bc6fc Mon Sep 17 00:00:00 2001 From: Jackarain Date: Mon, 29 Jul 2024 18:04:08 +0800 Subject: [PATCH] Improve file_hash --- proxy/include/proxy/proxy_server.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/include/proxy/proxy_server.hpp b/proxy/include/proxy/proxy_server.hpp index a3752e94b..e664acb85 100644 --- a/proxy/include/proxy/proxy_server.hpp +++ b/proxy/include/proxy/proxy_server.hpp @@ -3695,12 +3695,12 @@ R"x*x*x( while (file.read(bufs.data(), buf_size) || file.gcount()) sha1.process_bytes(bufs.data(), file.gcount()); - unsigned int hash[5]; - sha1.get_digest(*((boost::uuids::detail::sha1::digest_type*)&hash)); + boost::uuids::detail::sha1::digest_type hash; + sha1.get_digest(hash); std::stringstream ss; - for (int i = 0; i < 5; ++i) - ss << std::hex << std::setfill('0') << std::setw(8) << hash[i]; + for (auto const& c : hash) + ss << std::hex << std::setfill('0') << std::setw(2) << static_cast(c); return ss.str(); }