From a6c08edc13805151832be0e66852a6e9e161d910 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 27 Aug 2024 10:21:39 +0200 Subject: [PATCH] hash-util: use the `hex_lower` algorithm ... to optimize out the extra traversal step to lower the output string. Closes: https://github.com/csutils/csdiff/pull/200 --- src/lib/hash-util.hh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/lib/hash-util.hh b/src/lib/hash-util.hh index 40953123..157d774c 100644 --- a/src/lib/hash-util.hh +++ b/src/lib/hash-util.hh @@ -21,7 +21,6 @@ #include #include -#include /// compute TEng hash of `src` and return it as hex-encoded string template @@ -43,9 +42,6 @@ std::string hexHashStr(const TSrc &src) // convert the hash to a hex string std::string result; - boost::algorithm::hex(hash.begin(), hash.end(), back_inserter(result)); - - // convert uppercase letters to lowercase - boost::algorithm::to_lower(result); + boost::algorithm::hex_lower(hash.begin(), hash.end(), back_inserter(result)); return result; }