From 0a9fd0ca7575e96c7eac5a80dacedd074e568226 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 21 Aug 2014 18:22:25 +0200 Subject: beginning on support for partial bytes, c implemention is not working correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'c/sha3.h') diff --git a/c/sha3.h b/c/sha3.h index f984df5..b8c4b06 100644 --- a/c/sha3.h +++ b/c/sha3.h @@ -42,6 +42,26 @@ #endif +/** + * Suffix the message when calculating the Keccak hash sum + */ +#define KECCAK_SUFFIX "" + +/** + * Suffix the message when calculating the SHA-3 hash sum + */ +#define SHA3_SUFFIX "01" + +/** + * Suffix the message when calculating the RawSHAKE hash sum + */ +#define RawSHAKE_SUFFIX "11" + +/** + * Suffix the message when calculating the SHAKE hash sum + */ +#define SHAKE_SUFFIX "1111" + /** * Initialise Keccak sponge @@ -73,10 +93,12 @@ extern void sha3_update(byte* restrict_ msg, long msglen); * * @param msg The rest of the message, may be {@code null} * @param msglen The length of the partial message + * @param bits The number of bits at the end of the message not covered by `msglen` + * @param suffix The suffix concatenate to the message * @param withReturn Whether to return the hash instead of just do a quick squeeze phrase and return {@code null} * @return The hash sum, or {@code null} if withReturn is {@code false} */ -extern byte* sha3_digest(byte* restrict_ msg, long msglen, boolean withReturn); +extern byte* sha3_digest(byte* restrict_ msg, long msglen, long bits, char* restrict_ suffix, boolean withReturn); /** -- cgit v1.2.3-70-g09d2