sha3
Embeddable C11 SHA-3 implementation.
sha3.h
Go to the documentation of this file.
1
26#ifndef SHA3_H
27#define SHA3_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
33#include <stddef.h> // size_t
34#include <stdint.h> // uint8_t, uint64_t
35
55typedef union {
56 uint8_t u8[200];
57 uint64_t u64[25];
59
67typedef struct {
68 size_t num_bytes;
70 _Bool finalized;
71} sha3_t;
72
91void sha3_224(const uint8_t *src, size_t len, uint8_t dst[static 28]);
92
103
121_Bool sha3_224_absorb(sha3_t *hash, const uint8_t *src, const size_t len);
122
134void sha3_224_final(sha3_t *hash, uint8_t dst[28]);
135
154void sha3_256(const uint8_t *src, size_t len, uint8_t dst[static 32]);
155
166
184_Bool sha3_256_absorb(sha3_t *hash, const uint8_t *src, const size_t len);
185
197void sha3_256_final(sha3_t *hash, uint8_t dst[32]);
198
217void sha3_384(const uint8_t *src, size_t len, uint8_t dst[static 48]);
218
229
247_Bool sha3_384_absorb(sha3_t *hash, const uint8_t *src, const size_t len);
248
260void sha3_384_final(sha3_t *hash, uint8_t dst[48]);
261
280void sha3_512(const uint8_t *src, size_t len, uint8_t dst[static 64]);
281
292
310_Bool sha3_512_absorb(sha3_t *hash, const uint8_t *src, const size_t len);
311
323void sha3_512_final(sha3_t *hash, uint8_t dst[64]);
324
346typedef struct {
347 size_t num_bytes;
349 _Bool squeezing;
350} sha3_xof_t;
351
364void shake128_init(sha3_xof_t * const xof);
365
386_Bool shake128_absorb(sha3_xof_t *xof, const uint8_t *msg, const size_t len);
387
406void shake128_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
407
427void shake128(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
428
443
464_Bool shake256_absorb(sha3_xof_t *xof, const uint8_t *msg, const size_t len);
465
484void shake256_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
485
505void shake256(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
506
549void hmac_sha3_224(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[28]);
550
574void hmac_sha3_256(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[32]);
575
599void hmac_sha3_384(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[48]);
600
624void hmac_sha3_512(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[64]);
625
634typedef struct {
637 _Bool finalized;
639
654void hmac_sha3_224_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len);
655
673_Bool hmac_sha3_224_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len);
674
689void hmac_sha3_224_final(hmac_sha3_t *ctx, uint8_t mac[28]);
690
705void hmac_sha3_256_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len);
706
724_Bool hmac_sha3_256_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len);
725
740void hmac_sha3_256_final(hmac_sha3_t *ctx, uint8_t mac[32]);
741
756void hmac_sha3_384_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len);
757
775_Bool hmac_sha3_384_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len);
776
791void hmac_sha3_384_final(hmac_sha3_t *ctx, uint8_t mac[48]);
792
807void hmac_sha3_512_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len);
808
826_Bool hmac_sha3_512_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len);
827
842void hmac_sha3_512_final(hmac_sha3_t *ctx, uint8_t mac[64]);
843
860typedef struct {
861 const uint8_t *name;
862 const size_t name_len;
863 const uint8_t *custom;
864 const size_t custom_len;
866
895void cshake128(const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
896
925void cshake256(const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
926
951
978_Bool cshake128_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len);
979
1004void cshake128_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
1005
1032
1059_Bool cshake256_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len);
1060
1085void cshake256_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
1086
1103typedef struct {
1104 const uint8_t *key;
1105 const size_t key_len;
1106 const uint8_t *custom;
1107 const size_t custom_len;
1109
1136void kmac128(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1137
1164void kmac256(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1165
1193
1218_Bool kmac128_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len);
1219
1247void kmac128_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
1248
1281void kmac128_xof_once(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1282
1310
1335_Bool kmac256_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len);
1336
1366void kmac256_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
1367
1400void kmac256_xof_once(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1401
1423typedef struct {
1424 const uint8_t *ptr;
1425 size_t len;
1427
1432typedef struct {
1434 const size_t num_strs;
1435 const uint8_t *custom;
1436 const size_t custom_len;
1438
1460void tuplehash128(const tuplehash_params_t params, uint8_t *dst, const size_t len);
1461
1485void tuplehash256(const tuplehash_params_t params, uint8_t *dst, const size_t len);
1486
1514
1542void tuplehash128_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
1543
1572void tuplehash128_xof_once(const tuplehash_params_t params, uint8_t *dst, const size_t len);
1573
1601
1629void tuplehash256_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len);
1630
1659void tuplehash256_xof_once(const tuplehash_params_t params, uint8_t *dst, const size_t len);
1660
1676typedef struct {
1677 const size_t block_len;
1678 const uint8_t *custom;
1679 const size_t custom_len;
1681
1686typedef struct {
1689 size_t ofs,
1694
1720void parallelhash128(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1721
1749void parallelhash256(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1750
1778
1801void parallelhash128_xof_absorb(parallelhash_t *hash, const uint8_t *src, const size_t len);
1802
1830void parallelhash128_xof_squeeze(parallelhash_t *xof, uint8_t *dst, const size_t len);
1831
1863void parallelhash128_xof_once(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1864
1892
1915void parallelhash256_xof_absorb(parallelhash_t *xof, const uint8_t *src, const size_t len);
1916
1944void parallelhash256_xof_squeeze(parallelhash_t *xof, uint8_t *dst, const size_t len);
1945
1977void parallelhash256_xof_once(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
1978
2000typedef struct {
2001 size_t num_bytes;
2004} sha3_xof12_t;
2005
2025void turboshake128(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
2026
2053void turboshake128_custom(const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
2054
2074void turboshake256(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
2075
2100void turboshake256_custom(const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
2101
2109typedef struct {
2111 uint8_t pad;
2112} turboshake_t;
2113
2127
2147_Bool turboshake128_init_custom(turboshake_t *ts, const uint8_t pad);
2148
2169_Bool turboshake128_absorb(turboshake_t *ts, const uint8_t *src, const size_t len);
2170
2189void turboshake128_squeeze(turboshake_t *ts, uint8_t *dst, const size_t len);
2190
2204
2224_Bool turboshake256_init_custom(turboshake_t *ts, const uint8_t pad);
2225
2246_Bool turboshake256_absorb(turboshake_t *ts, const uint8_t *src, const size_t len);
2247
2266void turboshake256_squeeze(turboshake_t *ts, uint8_t *dst, const size_t len);
2267
2287typedef struct {
2289} k12_t;
2290
2307void k12_once(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len);
2308
2328void k12_custom_once(const uint8_t *src, const size_t src_len, const uint8_t *custom, const size_t custom_len, uint8_t *dst, const size_t dst_len);
2329
2349void k12_init(k12_t *k12, const uint8_t *src, const size_t src_len, const uint8_t *custom, const size_t custom_len);
2350
2368void k12_squeeze(k12_t *k12, uint8_t *dst, const size_t len);
2369
2385const char *sha3_backend(void);
2386
2387#ifdef __cplusplus
2388}
2389#endif /* __cplusplus */
2390
2391#endif /* SHA3_H */
void cshake128_xof_init(sha3_xof_t *xof, const cshake_params_t params)
Initialize cSHAKE128 XOF context.
void cshake256(const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Initialize cSHAKE256, absorb data, then squeeze bytes out.
void cshake256_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from cSHAKE256 XOF context.
_Bool cshake256_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len)
Absorb data into cSHAKE256 XOF context.
void cshake128(const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Initialize cSHAKE128, absorb data, then squeeze bytes out.
void cshake128_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from cSHAKE128 XOF context.
void cshake256_xof_init(sha3_xof_t *xof, const cshake_params_t params)
Initialize cSHAKE256 XOF context.
_Bool cshake128_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len)
Absorb data into cSHAKE128 XOF context.
void hmac_sha3_512_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len)
Initialize HMAC-SHA3-512 (FIPS 202, Section 7) context.
_Bool hmac_sha3_512_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len)
Absorb data into HMAC-SHA3-512 context.
void hmac_sha3_512(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[64])
Calculate HMAC-SHA3-512 of given key and data.
void hmac_sha3_224(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[28])
Calculate HMAC-SHA3-224 of given key and data.
_Bool hmac_sha3_224_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len)
Absorb data into HMAC-SHA3-224 context.
_Bool hmac_sha3_256_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len)
Absorb data into HMAC-SHA3-256 context.
void hmac_sha3_512_final(hmac_sha3_t *ctx, uint8_t mac[64])
Finalize HMAC-SHA3-512 context and write 64 byte MAC to destination buffer.
void hmac_sha3_224_final(hmac_sha3_t *ctx, uint8_t mac[28])
Finalize HMAC-SHA3-224 context and write 28 byte MAC to destination buffer.
void hmac_sha3_256_final(hmac_sha3_t *ctx, uint8_t mac[32])
Finalize HMAC-SHA3-256 context and write 32 byte MAC to destination buffer.
void hmac_sha3_256(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[32])
Calculate HMAC-SHA3-256 given key and data.
void hmac_sha3_384_final(hmac_sha3_t *ctx, uint8_t mac[48])
Finalize HMAC-SHA3-384 context and write 48 byte MAC to destination buffer.
void hmac_sha3_224_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len)
Initialize HMAC-SHA3-224 (FIPS 202, Section 7) context.
_Bool hmac_sha3_384_absorb(hmac_sha3_t *ctx, const uint8_t *src, const size_t len)
Absorb data into HMAC-SHA3-384 context.
void hmac_sha3_384(const uint8_t *key, const size_t key_len, const uint8_t *msg, const size_t msg_len, uint8_t mac[48])
Calculate HMAC-SHA3-384 of given key and data.
void hmac_sha3_256_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len)
Initialize HMAC-SHA3-256 (FIPS 202, Section 7) context.
void hmac_sha3_384_init(hmac_sha3_t *ctx, const uint8_t *key, const size_t key_len)
Initialize HMAC-SHA3-384 (FIPS 202, Section 7) context.
void k12_once(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into KangarooTwelve, then squeeze bytes out.
void k12_custom_once(const uint8_t *src, const size_t src_len, const uint8_t *custom, const size_t custom_len, uint8_t *dst, const size_t dst_len)
Absorb data into KangarooTwelve with customization string, then squeeze bytes out.
void k12_squeeze(k12_t *k12, uint8_t *dst, const size_t len)
Squeeze bytes from KangarooTwelve context.
void k12_init(k12_t *k12, const uint8_t *src, const size_t src_len, const uint8_t *custom, const size_t custom_len)
Initialize KangarooTwelve context.
void kmac128_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze data from KMAC128 XOF context.
void kmac256(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into KMAC256, then squeeze bytes out.
void kmac256_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze data from KMAC256 XOF context.
void kmac256_xof_init(sha3_xof_t *xof, const kmac_params_t params)
Initialize KMAC256 XOF context.
_Bool kmac256_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len)
Absorb data into KMAC256 XOF context.
_Bool kmac128_xof_absorb(sha3_xof_t *xof, const uint8_t *src, const size_t len)
Absorb data into KMAC128 XOF context.
void kmac256_xof_once(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into KMAC256 XOF context, then squeeze bytes out.
void kmac128(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into KMAC128, then squeeze bytes out.
void kmac128_xof_init(sha3_xof_t *xof, const kmac_params_t params)
Initialize KMAC128 XOF context.
void kmac128_xof_once(const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into KMAC128 XOF context, then squeeze bytes out.
const char * sha3_backend(void)
Get name of backend.
void parallelhash256_xof_absorb(parallelhash_t *xof, const uint8_t *src, const size_t len)
Absorb data into a ParallelHash256 XOF context.
void parallelhash256_xof_once(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb bytes into ParallelHash256 XOF, then squeeze bytes out.
void parallelhash128_xof_squeeze(parallelhash_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from a ParallelHash128 XOF context.
void parallelhash256_xof_init(parallelhash_t *xof, const parallelhash_params_t params)
Initialize a ParallelHash256 XOF context.
void parallelhash128(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into ParallelHash128, then squeeze bytes out.
void parallelhash128_xof_once(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb bytes into ParallelHash128 XOF, then squeeze bytes out.
void parallelhash128_xof_absorb(parallelhash_t *hash, const uint8_t *src, const size_t len)
Absorb data into a ParallelHash128 XOF context.
void parallelhash256_xof_squeeze(parallelhash_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from a ParallelHash256 XOF context.
void parallelhash128_xof_init(parallelhash_t *xof, const parallelhash_params_t params)
Initialize a ParallelHash128 XOF context.
void parallelhash256(const parallelhash_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into ParallelHash256, then squeeze bytes out.
void sha3_256_final(sha3_t *hash, uint8_t dst[32])
Finalize SHA3-256 hash context and write 32 bytes of output to destination buffer dst.
void sha3_384(const uint8_t *src, size_t len, uint8_t dst[static 48])
Calculate SHA3-384 hash of input data.
_Bool sha3_512_absorb(sha3_t *hash, const uint8_t *src, const size_t len)
Absorb input data into SHA3-512 hash context.
void sha3_224_final(sha3_t *hash, uint8_t dst[28])
Finalize SHA3-224 hash context and write 28 bytes of output to destination buffer dst.
void sha3_384_final(sha3_t *hash, uint8_t dst[48])
Finalize SHA3-384 hash context and write 48 bytes of output to destination buffer dst.
void sha3_256(const uint8_t *src, size_t len, uint8_t dst[static 32])
Calculate SHA3-256 hash of input data.
void sha3_224_init(sha3_t *hash)
Initialize SHA3-224 hash context.
void sha3_256_init(sha3_t *hash)
Initialize SHA3-256 hash context.
void sha3_224(const uint8_t *src, size_t len, uint8_t dst[static 28])
Calculate SHA3-224 hash of input data.
void sha3_512(const uint8_t *src, size_t len, uint8_t dst[static 64])
Calculate SHA3-512 hash of input data.
void sha3_512_final(sha3_t *hash, uint8_t dst[64])
Finalize SHA3-512 hash context and write 64 bytes of output to destination buffer dst.
void sha3_512_init(sha3_t *hash)
Initialize SHA3-512 hash context.
_Bool sha3_224_absorb(sha3_t *hash, const uint8_t *src, const size_t len)
Initialize SHA3-224 hash context.
_Bool sha3_384_absorb(sha3_t *hash, const uint8_t *src, const size_t len)
Absorb input data into SHA3-384 hash context.
_Bool sha3_256_absorb(sha3_t *hash, const uint8_t *src, const size_t len)
Absorb input data into SHA3-256 hash context.
void sha3_384_init(sha3_t *hash)
Initialize SHA3-384 hash context.
void shake128_init(sha3_xof_t *const xof)
Initialize SHAKE128 extendable-output function (XOF) context.
_Bool shake256_absorb(sha3_xof_t *xof, const uint8_t *msg, const size_t len)
Absorb data into SHAKE256 XOF context.
_Bool shake128_absorb(sha3_xof_t *xof, const uint8_t *msg, const size_t len)
Absorb data into SHAKE128 XOF context.
void shake256(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into SHAKE256 XOF, then squeeze bytes out.
void shake256_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from SHAKE256 XOF context.
void shake128_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from SHAKE128 XOF context.
void shake256_init(sha3_xof_t *xof)
Initialize SHAKE256 extendable-output function (XOF) context.
void shake128(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb data into SHAKE128 XOF, then squeeze bytes out.
void tuplehash256_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze bytes from a TupleHash256 XOF context.
void tuplehash256_xof_once(const tuplehash_params_t params, uint8_t *dst, const size_t len)
Absorb data into TupleHash256 XOF, then squeeze bytes out.
void tuplehash128_xof_squeeze(sha3_xof_t *xof, uint8_t *dst, const size_t len)
Squeeze data from TupleHash128 XOF context.
void tuplehash128(const tuplehash_params_t params, uint8_t *dst, const size_t len)
Absorb tuple and customization string into TupleHash128, then squeeze bytes out.
void tuplehash256_xof_init(sha3_xof_t *xof, const tuplehash_params_t params)
Initialize a TupleHash256 XOF context.
void tuplehash128_xof_init(sha3_xof_t *xof, const tuplehash_params_t params)
Initialize a TupleHash128 XOF context.
void tuplehash128_xof_once(const tuplehash_params_t params, uint8_t *dst, const size_t len)
Absorb data into TupleHash128 XOF, then squeeze bytes out.
void tuplehash256(const tuplehash_params_t params, uint8_t *dst, const size_t len)
Absorb tuple and customization string into TupleHash256, then squeeze bytes out.
void turboshake256_custom(const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb bytes into TurboSHAKE256 XOF with custom padding byte, then squeeze bytes out.
_Bool turboshake256_absorb(turboshake_t *ts, const uint8_t *src, const size_t len)
Absorb data into TurboSHAKE256 XOF context.
void turboshake128_init(turboshake_t *ts)
Initialize TurboSHAKE128 XOF context.
void turboshake256_init(turboshake_t *ts)
Initialize TurboSHAKE256 XOF context.
_Bool turboshake256_init_custom(turboshake_t *ts, const uint8_t pad)
Initialize TurboSHAKE256 XOF context with custom padding byte.
_Bool turboshake128_absorb(turboshake_t *ts, const uint8_t *src, const size_t len)
Absorb data into TurboSHAKE128 XOF context.
void turboshake128_custom(const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb bytes into TurboSHAKE128 XOF with custom padding byte, then squeeze bytes out.
void turboshake128_squeeze(turboshake_t *ts, uint8_t *dst, const size_t len)
Squeeze bytes from TurboSHAKE128 XOF context.
void turboshake128(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb bytes into TurboSHAKE128 XOF, then squeeze bytes out.
_Bool turboshake128_init_custom(turboshake_t *ts, const uint8_t pad)
Initialize TurboSHAKE128 XOF context with custom padding byte.
void turboshake256(const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
Absorb bytes into TurboSHAKE256 XOF, then squeeze bytes out.
void turboshake256_squeeze(turboshake_t *ts, uint8_t *dst, const size_t len)
Squeeze bytes from TurboSHAKE256 XOF context.
cSHAKE parameters.
Definition: sha3.h:860
const size_t custom_len
Definition: sha3.h:864
const uint8_t * custom
Definition: sha3.h:863
const size_t name_len
Definition: sha3.h:862
const uint8_t * name
Definition: sha3.h:861
HMAC-SHA3 (Hash-based Message Authentication Code) context (all members are private).
Definition: sha3.h:634
sha3_t outer
Definition: sha3.h:636
sha3_t inner
Definition: sha3.h:635
_Bool finalized
Definition: sha3.h:637
KangarooTwelve XOF context (all members are private).
Definition: sha3.h:2287
turboshake_t ts
Definition: sha3.h:2288
KMAC configuration parameters (key and customization string).
Definition: sha3.h:1103
const size_t key_len
Definition: sha3.h:1105
const size_t custom_len
Definition: sha3.h:1107
const uint8_t * key
Definition: sha3.h:1104
const uint8_t * custom
Definition: sha3.h:1106
ParallelHash configuration parameters.
Definition: sha3.h:1676
const size_t custom_len
Definition: sha3.h:1679
const uint8_t * custom
Definition: sha3.h:1678
const size_t block_len
Definition: sha3.h:1677
ParallelHash context (all members are private).
Definition: sha3.h:1686
sha3_xof_t curr_xof
Definition: sha3.h:1688
size_t num_blocks
Definition: sha3.h:1691
size_t block_len
Definition: sha3.h:1690
_Bool squeezing
Definition: sha3.h:1692
size_t ofs
Definition: sha3.h:1689
sha3_xof_t root_xof
Definition: sha3.h:1687
Iterative SHA-3 context (all members are private).
Definition: sha3.h:67
_Bool finalized
Definition: sha3.h:70
size_t num_bytes
Definition: sha3.h:68
sha3_state_t a
Definition: sha3.h:69
Iterative XOF context (all members are private) for XOFs with 12 round permutations.
Definition: sha3.h:2000
_Bool squeezing
Definition: sha3.h:2003
sha3_state_t a
Definition: sha3.h:2002
size_t num_bytes
Definition: sha3.h:2001
Iterative XOF context (all members are private).
Definition: sha3.h:346
sha3_state_t a
Definition: sha3.h:348
_Bool squeezing
Definition: sha3.h:349
size_t num_bytes
Definition: sha3.h:347
TupleHash configuration parameters.
Definition: sha3.h:1432
const tuplehash_str_t * strs
Definition: sha3.h:1433
const size_t num_strs
Definition: sha3.h:1434
const size_t custom_len
Definition: sha3.h:1436
const uint8_t * custom
Definition: sha3.h:1435
Individual element of TupleHash tuple.
Definition: sha3.h:1423
size_t len
Definition: sha3.h:1425
const uint8_t * ptr
Definition: sha3.h:1424
TurboShake XOF context (all members are private).
Definition: sha3.h:2109
sha3_xof12_t xof
Definition: sha3.h:2110
uint8_t pad
Definition: sha3.h:2111
Internal SHA-3 state (all members are private).
Definition: sha3.h:55