Skip to content

Commit a6c08ed

Browse files
committed
hash-util: use the hex_lower algorithm
... to optimize out the extra traversal step to lower the output string. Closes: #200
1 parent a53822e commit a6c08ed

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/lib/hash-util.hh

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <vector>
2222

2323
#include <boost/algorithm/hex.hpp>
24-
#include <boost/algorithm/string.hpp>
2524

2625
/// compute TEng hash of `src` and return it as hex-encoded string
2726
template <typename TEng, typename TSrc>
@@ -43,9 +42,6 @@ std::string hexHashStr(const TSrc &src)
4342

4443
// convert the hash to a hex string
4544
std::string result;
46-
boost::algorithm::hex(hash.begin(), hash.end(), back_inserter(result));
47-
48-
// convert uppercase letters to lowercase
49-
boost::algorithm::to_lower(result);
45+
boost::algorithm::hex_lower(hash.begin(), hash.end(), back_inserter(result));
5046
return result;
5147
}

0 commit comments

Comments
 (0)