summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-03-06 00:57:56 -0500
committerJohn Wiegley <johnw@newartisans.com>2010-03-06 00:57:56 -0500
commit93e0d8c67a1123d0b4eefcc53d00ba892142fd49 (patch)
tree74665ef27567dc0b54e64348db49aeee70f0c044 /src/utils.h
parentb90ce7890647c3f7cfb1103222df011a4534a1c9 (diff)
downloadfork-ledger-93e0d8c67a1123d0b4eefcc53d00ba892142fd49.tar.gz
fork-ledger-93e0d8c67a1123d0b4eefcc53d00ba892142fd49.tar.bz2
fork-ledger-93e0d8c67a1123d0b4eefcc53d00ba892142fd49.zip
Abstracted an sha1sum() function
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h10
1 files changed, 10 insertions, 0 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;