From 93e0d8c67a1123d0b4eefcc53d00ba892142fd49 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 6 Mar 2010 00:57:56 -0500 Subject: Abstracted an sha1sum() function --- src/utils.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/utils.h') 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; -- cgit v1.2.3