From 586026a29b9d069cbfea0c5de8f22f2383356ecc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 20 Feb 2022 14:29:53 +0100 Subject: Add block size macro constants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libblake.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/libblake.h b/libblake.h index a8fb8df..afd6904 100644 --- a/libblake.h +++ b/libblake.h @@ -103,6 +103,34 @@ libblake_decode_hex(const char *data, size_t n, void *out, int *validp); */ #define LIBBLAKE_BLAKE512_OUTPUT_SIZE (512 / 8) +/** + * The block size used by BLAKE224; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake224_update` + */ +#define LIBBLAKE_BLAKE224_BLOCK_SIZE 64 + +/** + * The block size used by BLAKE256; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake256_update` + */ +#define LIBBLAKE_BLAKE256_BLOCK_SIZE 64 + +/** + * The block size used by BLAKE384; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake384_update` + */ +#define LIBBLAKE_BLAKE384_BLOCK_SIZE 128 + +/** + * The block size used by BLAKE512; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake512_update` + */ +#define LIBBLAKE_BLAKE512_BLOCK_SIZE 128 + /** * State for BLAKEs hashing (BLAKE224 and BLAKE256) * @@ -505,6 +533,22 @@ libblake_blake512_digest(struct libblake_blake512_state *state, void *data, size /*********************************** BLAKE2 ***********************************/ +/** + * The block size used by BLAKE2s; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake2s_update` or + * `libblake_blake2s_force_update` + */ +#define LIBBLAKE_BLAKE2S_BLOCK_SIZE 64 + +/** + * The block size used by BLAKE2b; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake2b_update` or + * `libblake_blake2b_force_update` + */ +#define LIBBLAKE_BLAKE2B_BLOCK_SIZE 128 + /** * BLAKE2s hashing parameters */ @@ -1007,6 +1051,22 @@ libblake_blake2b_digest(struct libblake_blake2b_state *state, void *data, size_t /*********************************** BLAKE2X (!!DRAFT!!) ***********************************/ +/** + * The block size used by BLAKE2Xs; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake2xs_update` or + * `libblake_blake2xs_force_update` + */ +#define LIBBLAKE_BLAKE2XS_BLOCK_SIZE 64 + +/** + * The block size used by BLAKE2Xb; it will only + * process a multiple of this number of bytes in + * each call to `libblake_blake2xb_update` or + * `libblake_blake2xb_force_update` + */ +#define LIBBLAKE_BLAKE2XB_BLOCK_SIZE 128 + /** * BLAKE2Xs hashing parameters */ -- cgit v1.2.3-70-g09d2