summaryrefslogtreecommitdiff
path: root/sha3.h
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2023-09-04 01:32:55 -0400
committerPaul Duncan <pabs@pablotron.org>2023-09-04 01:32:55 -0400
commitaf768a2790fea5c39afa4bff5e3d483f32757ade (patch)
tree9d249e7076f35eac55315cd057d78848f605df4e /sha3.h
parent6390a565d8011193a9a5f215885c4e41490e49b8 (diff)
downloadsha3-af768a2790fea5c39afa4bff5e3d483f32757ade.tar.bz2
sha3-af768a2790fea5c39afa4bff5e3d483f32757ade.zip
sha3.[hc]: add parallelhash128(), parallelhash128_xof_{init,absorb,squeeze,once}(), test_parallelhash128(), and test_parallelhash128_xof() (the last one is currently not working)
Diffstat (limited to 'sha3.h')
-rw-r--r--sha3.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/sha3.h b/sha3.h
index b8e03c5..11dd8cb 100644
--- a/sha3.h
+++ b/sha3.h
@@ -97,6 +97,28 @@ void tuplehash256_xof_init(sha3_xof_t * const xof, const tuplehash_params_t para
void tuplehash256_xof_squeeze(sha3_xof_t * const xof, uint8_t *dst, const size_t dst_len);
void tuplehash256_xof_once(const tuplehash_params_t params, uint8_t *dst, const size_t dst_len);
+typedef struct {
+ const size_t block_len; // block size, in bytes
+ const uint8_t *custom; // customization string
+ const size_t custom_len; // length of customization string, in bytes
+} parallelhash_params_t;
+
+typedef struct {
+ sha3_xof_t root_xof, // root xof
+ curr_xof; // xof for current block (note: shake128, not cshake128)
+ size_t ofs, // offset in current block, in bytes
+ block_len, // block size, in bytes
+ num_blocks; // total number of blocks
+ _Bool squeezing; // current state
+} parallelhash_t;
+
+void parallelhash128(const parallelhash_params_t params, const uint8_t * const src, const size_t src_len, uint8_t * const dst, const size_t dst_len);
+
+void parallelhash128_xof_init(parallelhash_t *hash, const parallelhash_params_t params);
+void parallelhash128_xof_absorb(parallelhash_t *hash, const uint8_t *msg, const size_t msg_len);
+void parallelhash128_xof_squeeze(parallelhash_t *hash, uint8_t *dst, const size_t dst_len);
+void parallelhash128_xof_once(const parallelhash_params_t params, const uint8_t * const src, const size_t src_len, uint8_t * const dst, const size_t dst_len);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */