Skip to content

Commit 9f3279b

Browse files
author
Barnabás Domozi
committed
Fix boost hash digest
1 parent c709db4 commit 9f3279b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

util/include/util/hash.h

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

3838
sha1 hasher;
39-
unsigned int digest[5];
39+
unsigned char digest[20];
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-
ss.width(8);
46+
ss.width(2);
4747
ss.fill('0');
4848

49-
for (int i = 0; i < 5; ++i)
50-
ss << digest[i];
49+
for (int i = 0; i < 20; ++i)
50+
ss << (int)digest[i];
5151

5252
return ss.str();
5353
}

0 commit comments

Comments
 (0)