aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-09-12 20:18:55 +0200
committerMattias Andrée <maandree@kth.se>2024-09-12 20:18:55 +0200
commita17e0d582aaf91c6be55a5adbd5d8d38a09db222 (patch)
tree202a201357907ffd9dc72f586e19a99ac661365c /libhashsum.h
parentm (diff)
downloadlibhashsum-a17e0d582aaf91c6be55a5adbd5d8d38a09db222.tar.gz
libhashsum-a17e0d582aaf91c6be55a5adbd5d8d38a09db222.tar.bz2
libhashsum-a17e0d582aaf91c6be55a5adbd5d8d38a09db222.tar.xz
Add libhashsum_init_keccak_hasher2
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libhashsum.h')
-rw-r--r--libhashsum.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/libhashsum.h b/libhashsum.h
index 79c2cb6..b57493e 100644
--- a/libhashsum.h
+++ b/libhashsum.h
@@ -617,6 +617,61 @@ struct libhashsum_hasher {
};
+/**
+ * Keccak hash function parameters
+ * for `libhashsum_init_keccak_hasher2`
+ *
+ * @since 1.1
+ */
+struct libhashsum_keccak_params {
+ /**
+ * The bitrate, 0 for automatic
+ *
+ * This must be a multiple of 8
+ */
+ size_t ratebits;
+
+ /**
+ * The sponge capacity in bits, 0 for automatic
+ *
+ * This must be a multiple of 8
+ */
+ size_t capbits;
+
+ /**
+ * The hash size in bits, 0 for automatic
+ */
+ size_t hashbits;
+
+ /**
+ * The state size in bits, 0 for automatic
+ *
+ * This must be 0 or `25 * .wordbits`, it must
+ * also be 0 or `.ratebits + .capbits`, however
+ * if `.ratebits` or `.capbits` is 0, this value
+ * must be less than non-zero value (if both
+ * are 0, only the "0 or `25 * .wordbits`"
+ * restriction apply)
+ */
+ size_t statebits;
+
+ /**
+ * The word size in bits, 0 for automatic
+ *
+ * This must be a multiple of 8 and a power of 2,
+ * currently supported value are (apart from 0):
+ '* 8, 16, 32, and 64
+ */
+ size_t wordbits;
+
+ /**
+ * The number of squeezes to performed,
+ * 0 for automatic (which is 1)
+ */
+ size_t squeezes;
+};
+
+
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
@@ -1018,6 +1073,23 @@ int libhashsum_init_keccak_hasher(struct libhashsum_hasher *this, size_t ratebit
size_t capbits, size_t hashbits, size_t squeezes);
/**
+ * Create an initialised state for Keccak
+ * hashing and return hash functions and details
+ *
+ * @param this The output parameter for the functions, details, and state
+ * @param param Hash function parameters
+ * @return 0 on success, -1 on failure
+ *
+ * @throws EINVAL `*params` is invalid
+ * @throws ENOSYS Support was excluded at compile time
+ * @throws ENOMEM Not enough memory available
+ *
+ * @since 1.1
+ */
+LIBHASHSUM_NONNULL_
+int libhashsum_init_keccak_hasher2(struct libhashsum_hasher *this, const struct libhashsum_keccak_params *params); /* TODO man, test */
+
+/**
* Create an initialised state for SHA3-224
* hashing and return hash functions and details
*