diff options
-rw-r--r-- | src/utils.h | 10 | ||||
-rw-r--r-- | src/xact.cc | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/utils.h b/src/utils.h index 95ee35ce..a0c3f49f 100644 --- a/src/utils.h +++ b/src/utils.h @@ -659,6 +659,16 @@ inline string to_hex(uint_least32_t * message_digest, const int len = 1) return buf.str(); } +inline string sha1sum(const string& str) +{ + SHA1 sha; + sha.Reset(); + sha << str.c_str(); + uint_least32_t message_digest[5]; + sha.Result(message_digest); + return to_hex(message_digest, 5); +} + class push_xml { std::ostream& out; diff --git a/src/xact.cc b/src/xact.cc index 5dbf8c70..f78ea301 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -454,12 +454,7 @@ string xact_t::idstring() const string xact_t::id() const { - SHA1 sha; - sha.Reset(); - sha << idstring().c_str(); - uint_least32_t message_digest[5]; - sha.Result(message_digest); - return to_hex(message_digest, 5); + return sha1sum(idstring()); } namespace { |