aboutsummaryrefslogtreecommitdiff
path: root/sha3.h
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2023-09-05 21:18:49 -0400
committerPaul Duncan <pabs@pablotron.org>2023-09-05 21:18:49 -0400
commitabb8f678231d2af34b51bf1cb7fd853e123cefee (patch)
tree1ced9c0e7222e08e97c24b8b3b02c3dfefefb4f3 /sha3.h
parent671ef72433a6ea5420ae61dad8128034bccc7d1d (diff)
downloadsha3-abb8f678231d2af34b51bf1cb7fd853e123cefee.tar.bz2
sha3-abb8f678231d2af34b51bf1cb7fd853e123cefee.zip
sha3.[hc]: add turboshake{128,256}_custom()
Diffstat (limited to 'sha3.h')
-rw-r--r--sha3.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/sha3.h b/sha3.h
index 6ca8922..4f1ce06 100644
--- a/sha3.h
+++ b/sha3.h
@@ -1156,6 +1156,22 @@ void parallelhash256_xof_once(const parallelhash_params_t params, const uint8_t
void turboshake128(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
/**
+ * Initialize internal TurboSHAKE128 context with custom padding byte
+ * `pad`, absorb `src_len` bytes of input from in source buffer `src`,
+ * then squeeze `dst_len` bytes of output into destination buffer `dst`.
+ *
+ * Note: The padding byte value must be in the range [0x01, 0x7F] and
+ * can be used for domain separation.
+ *
+ * @param[in] pad Padding byte.
+ * @param[in] src Source buffer.
+ * @param[in] src_len Source buffer length, in bytes.
+ * @param[out] dst Destination buffer.
+ * @param[in] dst_len Destination buffer length, in bytes.
+ */
+void turboshake128_custom(const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
+
+/**
* Initialize internal TurboSHAKE256 context, absorb `src_len` bytes of
* input from in source buffer `src`, then squeeze `dst_len` bytes of output
* into destination buffer `dst`.
@@ -1167,6 +1183,22 @@ void turboshake128(const uint8_t *src, const size_t src_len, uint8_t *dst, const
*/
void turboshake256(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
+/**
+ * Initialize internal TurboSHAKE256 context with custom padding byte
+ * `pad`, absorb `src_len` bytes of input from in source buffer `src`,
+ * then squeeze `dst_len` bytes of output into destination buffer `dst`.
+ *
+ * Note: The padding byte value must be in the range [0x01, 0x7F] and
+ * can be used for domain separation.
+ *
+ * @param[in] pad Padding byte.
+ * @param[in] src Source buffer.
+ * @param[in] src_len Source buffer length, in bytes.
+ * @param[out] dst Destination buffer.
+ * @param[in] dst_len Destination buffer length, in bytes.
+ */
+void turboshake256_custom(const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
+
// TurboShake XOF context.
typedef struct {
sha3_xof_t xof;