We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fa53cf commit c358eb4Copy full SHA for c358eb4
util/include/util/hash.h
@@ -36,18 +36,27 @@ inline std::string sha1Hash(const std::string& data_)
36
using namespace boost::uuids::detail;
37
38
sha1 hasher;
39
- unsigned int digest[5];
+ boost::uuids::detail::sha1::digest_type digest;
40
41
hasher.process_bytes(data_.c_str(), data_.size());
42
hasher.get_digest(digest);
43
44
std::stringstream ss;
45
ss.setf(std::ios::hex, std::ios::basefield);
46
+
47
+#if BOOST_VERSION >= 108600 /* 1.86.0 */
48
+ ss.width(2);
49
+ ss.fill('0');
50
51
+ for (int i = 0; i < 20; ++i)
52
+ ss << digest[i];
53
+#else
54
ss.width(8);
55
ss.fill('0');
56
57
for (int i = 0; i < 5; ++i)
58
ss << digest[i];
59
+#endif
60
61
return ss.str();
62
}
0 commit comments