Skip to content

Commit c358eb4

Browse files
committed
Make the codebase compatible with Boost 1.86.
1 parent 2fa53cf commit c358eb4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

util/include/util/hash.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,27 @@ inline std::string sha1Hash(const std::string& data_)
3636
using namespace boost::uuids::detail;
3737

3838
sha1 hasher;
39-
unsigned int digest[5];
39+
boost::uuids::detail::sha1::digest_type digest;
4040

4141
hasher.process_bytes(data_.c_str(), data_.size());
4242
hasher.get_digest(digest);
4343

4444
std::stringstream ss;
4545
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
4654
ss.width(8);
4755
ss.fill('0');
4856

4957
for (int i = 0; i < 5; ++i)
5058
ss << digest[i];
59+
#endif
5160

5261
return ss.str();
5362
}

0 commit comments

Comments
 (0)