From b087848a2f054503ad8d7e8003380885e3c78d16 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Wed, 1 May 2013 15:49:40 +0200 Subject: [PATCH] sha_hash: also wrapped sha384 --- src/sha_hash.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sha_hash.h b/src/sha_hash.h index 0c6f565..5ebb764 100644 --- a/src/sha_hash.h +++ b/src/sha_hash.h @@ -41,6 +41,24 @@ public: } }; +class sha384hash : public hash_func +{ +public: + uint size() { + return SHA384_DIGEST_LENGTH; + } + + std::vector operator() (const std::vector&a) { + SHA384_CTX ctx; + SHA384_Init (&ctx); + SHA384_Update (&ctx, (const uint8_t*) & (a[0]), a.size() ); + std::vector r; + r.resize (size() ); + SHA384_Final ( (uint8_t*) & (r[0]), &ctx); + return r; + } +}; + class sha512hash : public hash_func { public: