aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/hash.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-10 13:25:10 -0500
committerJack Lloyd <[email protected]>2016-11-10 13:25:10 -0500
commitb7ae8043e963467eb222a44f48d66a1df36d9371 (patch)
treef5ec4059e21d874404c60595568a4a3d4d7305c9 /src/lib/hash/hash.cpp
parente6bf87b6b0d4d9c3877b79de53de58dc34a3acca (diff)
Add SHAKE-128 and SHAKE-256 as hash functions
Diffstat (limited to 'src/lib/hash/hash.cpp')
-rw-r--r--src/lib/hash/hash.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/hash/hash.cpp b/src/lib/hash/hash.cpp
index ede2f8c99..112554127 100644
--- a/src/lib/hash/hash.cpp
+++ b/src/lib/hash/hash.cpp
@@ -56,6 +56,10 @@
#include <botan/sha3.h>
#endif
+#if defined(BOTAN_HAS_SHAKE)
+ #include <botan/shake.h>
+#endif
+
#if defined(BOTAN_HAS_SKEIN_512)
#include <botan/skein_512.h>
#endif
@@ -242,6 +246,17 @@ std::unique_ptr<HashFunction> HashFunction::create(const std::string& algo_spec,
}
#endif
+#if defined(BOTAN_HAS_SHAKE)
+ if(req.algo_name() == "SHAKE-128")
+ {
+ return std::unique_ptr<HashFunction>(new SHAKE_128(req.arg_as_integer(0, 128)));
+ }
+ if(req.algo_name() == "SHAKE-256")
+ {
+ return std::unique_ptr<HashFunction>(new SHAKE_256(req.arg_as_integer(0, 256)));
+ }
+#endif
+
#if defined(BOTAN_HAS_WHIRLPOOL)
if(req.algo_name() == "Whirlpool")
{