aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-24 20:13:01 +0200
committerMattias Andrée <maandree@kth.se>2024-08-24 20:13:01 +0200
commitfebb5279f7bf3c86ec872c1b2ed1e024f73e64c5 (patch)
treeea6918fc1dcb29e11ce9399b8300a124cc0342cf /common.h
parentAdd support for Keccak, SHA3, SHAKE, and RawSHAKE via libkeccak>=1.3 (this version introduced zerocopy) (diff)
downloadlibhashsum-febb5279f7bf3c86ec872c1b2ed1e024f73e64c5.tar.gz
libhashsum-febb5279f7bf3c86ec872c1b2ed1e024f73e64c5.tar.bz2
libhashsum-febb5279f7bf3c86ec872c1b2ed1e024f73e64c5.tar.xz
Add BLAKE via libblake>=1.1 (this version introduced libblake_init())
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'common.h')
-rw-r--r--common.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/common.h b/common.h
index 903a0e9..a13e9c8 100644
--- a/common.h
+++ b/common.h
@@ -15,6 +15,18 @@
#if defined(SUPPORT_KECCAK) || defined(SUPPORT_SHA3) || defined(SUPPORT_SHAKE) || defined(SUPPORT_RAWSHAKE)
# define LIBHASHSUM_INCLUDE_LIBKECCAK_STATE
#endif
+#if defined(SUPPORT_BLAKE224) || defined(SUPPORT_BLAKE256)
+# define SUPPORT_BLAKES
+#endif
+#if defined(SUPPORT_BLAKE384) || defined(SUPPORT_BLAKE512)
+# define SUPPORT_BLAKEB
+#endif
+#if defined(SUPPORT_BLAKES) || defined(SUPPORT_BLAKEB)
+# define SUPPORT_BLAKE
+#endif
+#if defined(SUPPORT_BLAKE)
+# define LIBHASHSUM_INCLUDE_LIBBLAKE_STATE
+#endif
#include "libhashsum.h"
#include <ctype.h>
@@ -179,8 +191,8 @@ run_tests(const char *name, enum libhashsum_algorithm algorithm, size_t hash_siz
*p++ = 'b';
*p++ = '"';
while (bits--) {
- *p++ = "01"[(extra_bit >> 7) & 1U];
- extra_bit <<= 1;
+ *p++ = "01"[extra_bit & 1U];
+ extra_bit >>= 1;
}
*p++ = '"';
*p = '\0';