diff options
author | zyp <zyp@localhost> | 2006-05-09 22:33:27 +0200 |
---|---|---|
committer | zyp <zyp@localhost> | 2006-05-09 22:33:27 +0200 |
commit | 0c4fc1e72770fc78d87891e5c031272fca59e409 (patch) | |
tree | 10682cb815cff09ec1e2ce9beb619c916f08616c /src/sha1.cpp | |
parent | 373495b3a1c8ccdcfece70bac69625b6823ccec0 (diff) |
[project @ zyp-20060509203327-c8c93b489da2ea46]
[project @ 27]
Multihash library rewrite complete.
Diffstat (limited to 'src/sha1.cpp')
-rw-r--r-- | src/sha1.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sha1.cpp b/src/sha1.cpp new file mode 100644 index 0000000..1d99abd --- /dev/null +++ b/src/sha1.cpp @@ -0,0 +1,17 @@ +#include "sha1.h" + +namespace Multihash { + SHA1::SHA1(Hash* n) : Hash(n) { + SHA1_Init(&sha1_ctx); + } + + void SHA1::hash_update(const char* data, int length) { + SHA1_Update(&sha1_ctx, data, length); + } + + std::string SHA1::hash_digest() { + char digest[20]; + SHA1_Final((unsigned char*)digest, &sha1_ctx); + return Hex::hex(digest, 20); + } +} |