summaryrefslogtreecommitdiff
path: root/sha3.h
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2023-09-01 23:15:00 -0400
committerPaul Duncan <pabs@pablotron.org>2023-09-01 23:15:00 -0400
commite23ca862bbe2d97675277dde443fbef498db771f (patch)
treebeac0825566e38ea4b63728e407cb9cfd03edde0 /sha3.h
parentc7f630ed23144939a540219787c7be3ffe14b24c (diff)
downloadsha3-e23ca862bbe2d97675277dde443fbef498db771f.tar.bz2
sha3-e23ca862bbe2d97675277dde443fbef498db771f.zip
./sha3.h: add shake{128,256}_xof_*()
Diffstat (limited to 'sha3.h')
-rw-r--r--sha3.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/sha3.h b/sha3.h
index 6e49a40..4fbf0e1 100644
--- a/sha3.h
+++ b/sha3.h
@@ -7,6 +7,17 @@ extern "C" {
#include <stdint.h>
+typedef union {
+ uint8_t u8[200];
+ uint64_t u64[25];
+} sha3_state_t;
+
+typedef struct {
+ size_t num_bytes;
+ sha3_state_t a;
+ _Bool squeezing;
+} sha3_xof_t;
+
void sha3_224(const uint8_t *m, size_t m_len, uint8_t dst[static 28]);
void sha3_256(const uint8_t *m, size_t m_len, uint8_t dst[static 32]);
void sha3_384(const uint8_t *m, size_t m_len, uint8_t dst[static 48]);
@@ -15,6 +26,16 @@ void sha3_512(const uint8_t *m, size_t m_len, uint8_t dst[static 64]);
void shake128(const uint8_t *m, size_t m_len, uint8_t dst[static 16]);
void shake256(const uint8_t *m, size_t m_len, uint8_t dst[static 32]);
+void shake128_xof_init(sha3_xof_t * const xof);
+_Bool shake128_xof_absorb(sha3_xof_t * const xof, const uint8_t * const m, const size_t len);
+_Bool shake128_xof_absorb_done(sha3_xof_t * const xof);
+_Bool shake128_xof_squeeze(sha3_xof_t * const xof, uint8_t * const dst, const size_t dst_len);
+
+void shake256_xof_init(sha3_xof_t * const xof);
+_Bool shake256_xof_absorb(sha3_xof_t * const xof, const uint8_t * const m, const size_t len);
+_Bool shake256_xof_absorb_done(sha3_xof_t * const xof);
+_Bool shake256_xof_squeeze(sha3_xof_t * const xof, uint8_t * const dst, const size_t dst_len);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */