summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2014-04-13 17:13:51 -0300
committerJohn Wiegley <johnw@newartisans.com>2014-04-17 14:27:21 -0500
commit0ef825640963d60e4733553ff0e8c590c0ce2c3b (patch)
treeacea3a68341bc8dda85533b4cf9678c8e58c39f8 /src/utils.h
parentefffabadfa360eb083e1e403d1e240a6fb6f3efa (diff)
downloadledger-0ef825640963d60e4733553ff0e8c590c0ce2c3b.tar.gz
ledger-0ef825640963d60e4733553ff0e8c590c0ce2c3b.tar.bz2
ledger-0ef825640963d60e4733553ff0e8c590c0ce2c3b.zip
Replace sha1.cc with boost::uuid::details::sha1
sha1.cc is not redistributable by Debian because the license doesn't permit redistribution of modified versions. This isn't ideal since the ::details namespace is subject to change, but it avoids adding a dependency to ledger.
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/utils.h b/src/utils.h
index 70b3bae9..95cc64fd 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -44,6 +44,8 @@
#ifndef _UTILS_H
#define _UTILS_H
+#include <boost/uuid/sha1.hpp>
+
/**
* @name Default values
*/
@@ -625,11 +627,12 @@ inline string to_hex(unsigned int * message_digest, const int len = 1)
inline string sha1sum(const string& str)
{
- SHA1 sha;
- sha.Reset();
- sha << str.c_str();
+ boost::uuids::detail::sha1 sha;
+
+ sha.process_bytes(str.c_str(), str.length());
+
unsigned int message_digest[5];
- sha.Result(message_digest);
+ sha.get_digest(message_digest);
return to_hex(message_digest, 5);
}