SHA3 family of hash functions. More...
#include "common.h"Go to the source code of this file.
Data Structures | |
| struct | qsc_keccak_state |
| The Keccak state array; state array must be initialized by the caller. More... | |
| struct | qsc_kpa_state |
| The KPA state array; state array must be initialized by the caller. More... | |
Macros | |
| #define | QSC_KECCAK_CSHAKE_DOMAIN_ID 0x04U |
| The cSHAKE domain id. | |
| #define | QSC_KECCAK_KMAC_DOMAIN_ID 0x04U |
| The KMAC domain id. | |
| #define | QSC_KECCAK_KPA_DOMAIN_ID 0x41U |
| The KPA domain id. | |
| #define | QSC_KECCAK_PERMUTATION_ROUNDS 24ULL |
| The standard number of permutation rounds. | |
| #define | QSC_KECCAK_PERMUTATION_MAX_ROUNDS 48ULL |
| The maximum number of permutation rounds. | |
| #define | QSC_KECCAK_PERMUTATION_MIN_ROUNDS 12ULL |
| The minimum number of permutation rounds. | |
| #define | QSC_KECCAK_SHA3_DOMAIN_ID 0x06U |
| The SHA3 domain id. | |
| #define | QSC_KECCAK_SHAKE_DOMAIN_ID 0x1FU |
| The SHAKE domain id. | |
| #define | QSC_KECCAK_STATE_BYTE_SIZE 200ULL |
| The Keccak state array byte size. | |
| #define | QSC_KECCAK_128_RATE 168ULL |
| The 128-bit absorption rate. | |
| #define | QSC_KECCAK_256_RATE 136ULL |
| The 256-bit absorption rate. | |
| #define | QSC_KECCAK_512_RATE 72ULL |
| The 512 bit absorption rate. | |
| #define | QSC_KECCAK_STATE_SIZE 25ULL |
| The Keccak SHA3 uint64 state array size. | |
| #define | QSC_KECCAK_STATE_BYTE_SIZE 200ULL |
| The Keccak state array byte size. | |
| #define | QSC_KMAC_256_KEY_SIZE 32ULL |
| The KMAC-256 key size in bytes. | |
| #define | QSC_KMAC_512_KEY_SIZE 64ULL |
| The KMAC-512 key size in bytes. | |
| #define | QSC_KECCAK_SCBKDF_DOMAIN_ID 0x42U |
| The SCBKDF domain id. | |
| #define | QSC_SHA3_128_HASH_SIZE 16ULL |
| The QSC_SHA3_128_HASH_SIZE hash size in bytes (16) | |
| #define | QSC_SHA3_256_HASH_SIZE 32ULL |
| The SHA-256 hash size in bytes (32) | |
| #define | QSC_SHA3_512_HASH_SIZE 64ULL |
| The SHA-512 hash size in bytes (64) | |
| #define | QSC_SHAKE_256_KEY_SIZE 32ULL |
| The SHAKE-256 key size in bytes. | |
| #define | QSC_SHAKE512_KEY_SIZE 64ULL |
| The SHAKE-512 key size in bytes. | |
| #define | QSC_KPA_128_KEY_SIZE 16ULL |
| The KPA-128 key size in bytes. | |
| #define | QSC_KPA_256_KEY_SIZE 32ULL |
| The KPA-256 key size in bytes. | |
| #define | QSC_KPA_512_KEY_SIZE 64ULL |
| The KPA-512 key size in bytes. | |
| #define | QSC_KPA_ROUNDS 12ULL |
| The number of Keccak rounds used by a KPA permutation. | |
| #define | QSC_KPA_PARALLELISM 8ULL |
| The KPA degree of parallelization. | |
Enumerations | |
| enum | qsc_keccak_rate { qsc_keccak_rate_none = 0x00U , qsc_keccak_rate_128 = 0xA8U , qsc_keccak_rate_256 = 0x88U , qsc_keccak_rate_512 = 0x48U } |
| The Keccak rate; determines which security strength is used by the function, 128, 256, or 512-bit. More... | |
Functions | |
| QSC_EXPORT_API void | qsc_keccak_absorb (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *message, size_t msglen, uint8_t domain, size_t rounds) |
| Absorb an input message into the Keccak state. | |
| QSC_EXPORT_API void | qsc_keccak_absorb_custom (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *custom, size_t custlen, const uint8_t *name, size_t namelen, size_t rounds) |
| Absorb the custom, and name arrays into the Keccak state. | |
| QSC_EXPORT_API void | qsc_keccak_absorb_key_custom (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *key, size_t keylen, const uint8_t *custom, size_t custlen, const uint8_t *name, size_t namelen, size_t rounds) |
| Absorb the custom, name, and key arrays into the Keccak state. | |
| QSC_EXPORT_API void | qsc_keccak_dispose (qsc_keccak_state *ctx) |
| Dispose of the Keccak state. | |
| QSC_EXPORT_API void | qsc_keccak_finalize (qsc_keccak_state *ctx, qsc_keccak_rate rate, uint8_t *output, size_t outlen, uint8_t domain, size_t rounds) |
| Finalize the Keccak state. | |
| QSC_EXPORT_API void | qsc_keccak_incremental_absorb (qsc_keccak_state *ctx, uint32_t rate, const uint8_t *message, size_t msglen) |
| Absorb bytes into state incrementally. | |
| QSC_EXPORT_API void | qsc_keccak_incremental_finalize (qsc_keccak_state *ctx, uint32_t rate, uint8_t domain) |
| Finalize state added incrementally. | |
| QSC_EXPORT_API void | qsc_keccak_incremental_squeeze (qsc_keccak_state *ctx, size_t rate, uint8_t *output, size_t outlen) |
| Extract an array of bytes from the Keccak state. | |
| QSC_EXPORT_API void | qsc_keccak_permute (qsc_keccak_state *ctx, size_t rounds) |
| The Keccak permute function. Internal function: Permutes the state array, can be used in external constructions. | |
| QSC_EXPORT_API void | qsc_keccak_permute_p1600c (uint64_t *state, size_t rounds) |
| The compact Keccak permute function. Internal function: Permutes the state array, can be used in external constructions. | |
| QSC_EXPORT_API void | qsc_keccak_permute_p1600u (uint64_t *state) |
| The unrolled Keccak permute function. Internal function: Permutes the state array, can be used in external constructions. | |
| QSC_EXPORT_API void | qsc_keccak_squeezeblocks (qsc_keccak_state *ctx, uint8_t *output, size_t nblocks, qsc_keccak_rate rate, size_t rounds) |
| The Keccak squeeze function. | |
| QSC_EXPORT_API void | qsc_keccak_initialize_state (qsc_keccak_state *ctx) |
| Initializes a Keccak state structure, must be called before message processing. Long form api: must be used in conjunction with the block-update and finalize functions. | |
| QSC_EXPORT_API void | qsc_keccak_update (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *message, size_t msglen, size_t rounds) |
| Update Keccak state with message input. | |
| QSC_EXPORT_API void | qsc_sha3_compute128 (uint8_t *output, const uint8_t *message, size_t msglen) |
| Process a message with SHA3-128 and return the hash code in the output byte array. Short form api: processes the entire message and computes the hash code with a single call. | |
| QSC_EXPORT_API void | qsc_sha3_compute256 (uint8_t *output, const uint8_t *message, size_t msglen) |
| Process a message with SHA3-256 and return the hash code in the output byte array. Short form api: processes the entire message and computes the hash code with a single call. | |
| QSC_EXPORT_API void | qsc_sha3_compute512 (uint8_t *output, const uint8_t *message, size_t msglen) |
| Process a message with SHA3-512 and return the hash code in the output byte array. Short form api: processes the entire message and computes the hash code with a single call. | |
| QSC_EXPORT_API void | qsc_sha3_finalize (qsc_keccak_state *ctx, qsc_keccak_rate rate, uint8_t *output) |
| Finalize the message state and returns the hash value in output. Long form api: must be used in conjunction with the initialize and block-update functions. Absorb the last block of message and create the hash value. Produces a 32 byte output code using QSC_KECCAK_256_RATE, 64 bytes with QSC_KECCAK_512_RATE. | |
| QSC_EXPORT_API void | qsc_sha3_initialize (qsc_keccak_state *ctx) |
| Initialize the SHA3 state Long form api: Must be called before the update or finalize functions are called. | |
| QSC_EXPORT_API void | qsc_sha3_update (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *message, size_t msglen) |
| Update SHA3 with message input. Long form api: must be used in conjunction with the initialize and finalize functions. Absorbs the input message into the state. | |
| QSC_EXPORT_API void | qsc_shake128_compute (uint8_t *output, size_t outlen, const uint8_t *key, size_t keylen) |
| Key a SHAKE-128 instance, and generate an array of pseudo-random bytes. Short form api: processes the key and generates the pseudo-random output with a single call. | |
| QSC_EXPORT_API void | qsc_shake256_compute (uint8_t *output, size_t outlen, const uint8_t *key, size_t keylen) |
| Key a SHAKE-256 instance, and generate an array of pseudo-random bytes. Short form api: processes the key and generates the pseudo-random output with a single call. | |
| QSC_EXPORT_API void | qsc_shake512_compute (uint8_t *output, size_t outlen, const uint8_t *key, size_t keylen) |
| Key a SHAKE-512 instance, and generate an array of pseudo-random bytes. Short form api: processes the key and generates the pseudo-random output with a single call. | |
| QSC_EXPORT_API void | qsc_shake_initialize (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *key, size_t keylen) |
| The SHAKE initialize function. Long form api: must be used in conjunction with the squeezeblocks function. Absorb and finalize an input key byte array. | |
| QSC_EXPORT_API void | qsc_shake_squeezeblocks (qsc_keccak_state *ctx, qsc_keccak_rate rate, uint8_t *output, size_t nblocks) |
| The SHAKE squeeze function. Long form api: must be used in conjunction with the initialize function. Permutes and extracts the state to an output byte array. | |
| QSC_EXPORT_API void | qsc_cshake128_compute (uint8_t *output, size_t outlen, const uint8_t *key, size_t keylen, const uint8_t *name, size_t namelen, const uint8_t *custom, size_t custlen) |
| Key a cSHAKE-128 instance and generate pseudo-random output. Short form api: processes the key, name, and custom inputs and generates the pseudo-random output with a single call. Permutes and extracts the state to an output byte array.. | |
| QSC_EXPORT_API void | qsc_cshake256_compute (uint8_t *output, size_t outlen, const uint8_t *key, size_t keylen, const uint8_t *name, size_t namelen, const uint8_t *custom, size_t custlen) |
| Key a cSHAKE-256 instance and generate pseudo-random output. Short form api: processes the key, name, and custom inputs and generates the pseudo-random output with a single call. Permutes and extracts the state to an output byte array. | |
| QSC_EXPORT_API void | qsc_cshake512_compute (uint8_t *output, size_t outlen, const uint8_t *key, size_t keylen, const uint8_t *name, size_t namelen, const uint8_t *custom, size_t custlen) |
| Key a cSHAKE-512 instance and generate pseudo-random output. Short form api: processes the key, name, and custom inputs and generates the pseudo-random output with a single call. Permutes and extracts the state to an output byte array. | |
| QSC_EXPORT_API void | qsc_cshake_initialize (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *key, size_t keylen, const uint8_t *name, size_t namelen, const uint8_t *custom, size_t custlen) |
| The cSHAKE initialize function. Long form api: must be used in conjunction with the squeezeblocks function. Initialize the name and customization strings into the state. | |
| QSC_EXPORT_API void | qsc_cshake_squeezeblocks (qsc_keccak_state *ctx, qsc_keccak_rate rate, uint8_t *output, size_t nblocks) |
| The cSHAKE squeeze function. Long form api: must be used in conjunction with the initialize function. Permutes and extracts blocks of state to an output byte array. | |
| QSC_EXPORT_API void | qsc_cshake_update (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *key, size_t keylen) |
| The cSHAKE update function. Long form api: must be used in conjunction with the initialize and squeezeblocks functions. Finalize an input key directly into the state. | |
| QSC_EXPORT_API void | qsc_kmac128_compute (uint8_t *output, size_t outlen, const uint8_t *message, size_t msglen, const uint8_t *key, size_t keylen, const uint8_t *custom, size_t custlen) |
| Key a KMAC-128 instance and generate a MAC code. Short form api: processes the key and custom inputs and generates the MAC code with a single call. Key the MAC generator process a message and output the MAC code. | |
| QSC_EXPORT_API void | qsc_kmac256_compute (uint8_t *output, size_t outlen, const uint8_t *message, size_t msglen, const uint8_t *key, size_t keylen, const uint8_t *custom, size_t custlen) |
| Key a KMAC-256 instance and generate a MAC code. Short form api: processes the key and custom inputs and generates the MAC code with a single call. Key the MAC generator process a message and output the MAC code. | |
| QSC_EXPORT_API void | qsc_kmac512_compute (uint8_t *output, size_t outlen, const uint8_t *message, size_t msglen, const uint8_t *key, size_t keylen, const uint8_t *custom, size_t custlen) |
| Key a KMAC-512 instance and generate a MAC code. Short form api: processes the key and custom inputs and generates the MAC code with a single call. Key the MAC generator process a message and output the MAC code. | |
| QSC_EXPORT_API void | qsc_kmac_update (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *message, size_t msglen) |
| The KMAC message update function. Long form api: must be used in conjunction with the initialize and finalize functions. | |
| QSC_EXPORT_API void | qsc_kmac_finalize (qsc_keccak_state *ctx, qsc_keccak_rate rate, uint8_t *output, size_t outlen) |
| The KMAC finalize function. Long form api: must be used in conjunction with the initialize and blockupdate functions. Final processing and calculation of the MAC code. | |
| QSC_EXPORT_API void | qsc_kmac_initialize (qsc_keccak_state *ctx, qsc_keccak_rate rate, const uint8_t *key, size_t keylen, const uint8_t *custom, size_t custlen) |
| Initialize a KMAC instance. Long form api: must be used in conjunction with the blockupdate and finalize functions. Key the MAC generator and initialize the internal state. | |
| QSC_EXPORT_API void | qsc_kpa_finalize (qsc_kpa_state *ctx, uint8_t *output, size_t outlen) |
| The KPA finalize function. Long form api: must be used in conjunction with the initialize and blockupdate functions. Final processing and calculation of the MAC code. | |
| QSC_EXPORT_API void | qsc_kpa_initialize (qsc_kpa_state *ctx, const uint8_t *key, size_t keylen, const uint8_t *custom, size_t custlen) |
| Initialize a KPA instance. Long form api: must be used in conjunction with the blockupdate and finalize functions. Key the MAC generator and initialize the internal state. | |
| QSC_EXPORT_API void | qsc_kpa_update (qsc_kpa_state *ctx, const uint8_t *message, size_t msglen) |
| The KPA message update function. Long form api: must be used in conjunction with the initialize and finalize functions. | |
| QSC_EXPORT_API void | qsc_kpa_dispose (qsc_kpa_state *ctx) |
| Dispose of the KPA state. | |
| QSC_EXPORT_API void | qsc_shake_128x4 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, size_t outlen, const uint8_t *inp0, const uint8_t *inp1, const uint8_t *inp2, const uint8_t *inp3, size_t inplen) |
| Process 4 SHAKE-128 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_shake_256x4 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, size_t outlen, const uint8_t *inp0, const uint8_t *inp1, const uint8_t *inp2, const uint8_t *inp3, size_t inplen) |
| Process 4 SHAKE-256 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_shake_512x4 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, size_t outlen, const uint8_t *inp0, const uint8_t *inp1, const uint8_t *inp2, const uint8_t *inp3, size_t inplen) |
| Process 4 SHAKE-512 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_shake_128x8 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, uint8_t *out4, uint8_t *out5, uint8_t *out6, uint8_t *out7, size_t outlen, const uint8_t *inp0, const uint8_t *inp1, const uint8_t *inp2, const uint8_t *inp3, const uint8_t *inp4, const uint8_t *inp5, const uint8_t *inp6, const uint8_t *inp7, size_t inplen) |
| Process 8 SHAKE-128 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_shake_256x8 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, uint8_t *out4, uint8_t *out5, uint8_t *out6, uint8_t *out7, size_t outlen, const uint8_t *inp0, const uint8_t *inp1, const uint8_t *inp2, const uint8_t *inp3, const uint8_t *inp4, const uint8_t *inp5, const uint8_t *inp6, const uint8_t *inp7, size_t inplen) |
| Process 8 SHAKE-256 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_shake_512x8 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, uint8_t *out4, uint8_t *out5, uint8_t *out6, uint8_t *out7, size_t outlen, const uint8_t *inp0, const uint8_t *inp1, const uint8_t *inp2, const uint8_t *inp3, const uint8_t *inp4, const uint8_t *inp5, const uint8_t *inp6, const uint8_t *inp7, size_t inplen) |
| Process 8 SHAKE-512 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_kmac_128x4 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, size_t outlen, const uint8_t *key0, const uint8_t *key1, const uint8_t *key2, const uint8_t *key3, size_t keylen, const uint8_t *cst0, const uint8_t *cst1, const uint8_t *cst2, const uint8_t *cst3, size_t cstlen, const uint8_t *msg0, const uint8_t *msg1, const uint8_t *msg2, const uint8_t *msg3, size_t msglen) |
| Process 4 KMAC-128 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_kmac_256x4 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, size_t outlen, const uint8_t *key0, const uint8_t *key1, const uint8_t *key2, const uint8_t *key3, size_t keylen, const uint8_t *cst0, const uint8_t *cst1, const uint8_t *cst2, const uint8_t *cst3, size_t cstlen, const uint8_t *msg0, const uint8_t *msg1, const uint8_t *msg2, const uint8_t *msg3, size_t msglen) |
| Process 4 KMAC-256 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_kmac_512x4 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, size_t outlen, const uint8_t *key0, const uint8_t *key1, const uint8_t *key2, const uint8_t *key3, size_t keylen, const uint8_t *cst0, const uint8_t *cst1, const uint8_t *cst2, const uint8_t *cst3, size_t cstlen, const uint8_t *msg0, const uint8_t *msg1, const uint8_t *msg2, const uint8_t *msg3, size_t msglen) |
| Process 4 KMAC-512 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_kmac_128x8 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, uint8_t *out4, uint8_t *out5, uint8_t *out6, uint8_t *out7, size_t outlen, const uint8_t *key0, const uint8_t *key1, const uint8_t *key2, const uint8_t *key3, const uint8_t *key4, const uint8_t *key5, const uint8_t *key6, const uint8_t *key7, size_t keylen, const uint8_t *cst0, const uint8_t *cst1, const uint8_t *cst2, const uint8_t *cst3, const uint8_t *cst4, const uint8_t *cst5, const uint8_t *cst6, const uint8_t *cst7, size_t cstlen, const uint8_t *msg0, const uint8_t *msg1, const uint8_t *msg2, const uint8_t *msg3, const uint8_t *msg4, const uint8_t *msg5, const uint8_t *msg6, const uint8_t *msg7, size_t msglen) |
| Process 8 KMAC-128 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_kmac_256x8 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, uint8_t *out4, uint8_t *out5, uint8_t *out6, uint8_t *out7, size_t outlen, const uint8_t *key0, const uint8_t *key1, const uint8_t *key2, const uint8_t *key3, const uint8_t *key4, const uint8_t *key5, const uint8_t *key6, const uint8_t *key7, size_t keylen, const uint8_t *cst0, const uint8_t *cst1, const uint8_t *cst2, const uint8_t *cst3, const uint8_t *cst4, const uint8_t *cst5, const uint8_t *cst6, const uint8_t *cst7, size_t cstlen, const uint8_t *msg0, const uint8_t *msg1, const uint8_t *msg2, const uint8_t *msg3, const uint8_t *msg4, const uint8_t *msg5, const uint8_t *msg6, const uint8_t *msg7, size_t msglen) |
| Process 8 KMAC-256 instances simultaneously using SIMD instructions. | |
| QSC_EXPORT_API void | qsc_kmac_512x8 (uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3, uint8_t *out4, uint8_t *out5, uint8_t *out6, uint8_t *out7, size_t outlen, const uint8_t *key0, const uint8_t *key1, const uint8_t *key2, const uint8_t *key3, const uint8_t *key4, const uint8_t *key5, const uint8_t *key6, const uint8_t *key7, size_t keylen, const uint8_t *cst0, const uint8_t *cst1, const uint8_t *cst2, const uint8_t *cst3, const uint8_t *cst4, const uint8_t *cst5, const uint8_t *cst6, const uint8_t *cst7, size_t cstlen, const uint8_t *msg0, const uint8_t *msg1, const uint8_t *msg2, const uint8_t *msg3, const uint8_t *msg4, const uint8_t *msg5, const uint8_t *msg6, const uint8_t *msg7, size_t msglen) |
| Process 8 KMAC-512 instances simultaneously using SIMD instructions. | |
SHA3 family of hash functions.
This header defines the public API and documentation for SHA3 digest, SHAKE, cSHAKE, and KMAC implementations. The API supports both short-form functions (processing an entire message in one call) and long-form functions (initialize, update, finalize) for incremental processing of data.
| #define QSC_KECCAK_STATE_BYTE_SIZE 200ULL |
The Keccak state array byte size.
The Keccak SHA3 state size in bytes.
| #define QSC_KECCAK_STATE_BYTE_SIZE 200ULL |
The Keccak state array byte size.
The Keccak SHA3 state size in bytes.
| enum qsc_keccak_rate |
| QSC_EXPORT_API void qsc_cshake128_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | name, | ||
| size_t | namelen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Key a cSHAKE-128 instance and generate pseudo-random output. Short form api: processes the key, name, and custom inputs and generates the pseudo-random output with a single call. Permutes and extracts the state to an output byte array..
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| name | [const uint8_t*] The function name string |
| namelen | [size_t] The byte length of the function name |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_cshake256_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | name, | ||
| size_t | namelen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Key a cSHAKE-256 instance and generate pseudo-random output. Short form api: processes the key, name, and custom inputs and generates the pseudo-random output with a single call. Permutes and extracts the state to an output byte array.
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| name | [const uint8_t*] The function name string |
| namelen | [size_t] The byte length of the function name |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_cshake512_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | name, | ||
| size_t | namelen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Key a cSHAKE-512 instance and generate pseudo-random output. Short form api: processes the key, name, and custom inputs and generates the pseudo-random output with a single call. Permutes and extracts the state to an output byte array.
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| name | [const uint8_t*] The function name string |
| namelen | [size_t] The byte length of the function name |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_cshake_initialize | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | name, | ||
| size_t | namelen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
The cSHAKE initialize function. Long form api: must be used in conjunction with the squeezeblocks function. Initialize the name and customization strings into the state.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| name | [const uint8_t*] The function name string |
| namelen | [size_t] The byte length of the function name |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_cshake_squeezeblocks | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| uint8_t * | output, | ||
| size_t | nblocks ) |
The cSHAKE squeeze function. Long form api: must be used in conjunction with the initialize function. Permutes and extracts blocks of state to an output byte array.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| output | [uint8_t*] The output byte array |
| nblocks | [size_t] The number of blocks to extract |
| QSC_EXPORT_API void qsc_cshake_update | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | key, | ||
| size_t | keylen ) |
The cSHAKE update function. Long form api: must be used in conjunction with the initialize and squeezeblocks functions. Finalize an input key directly into the state.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| QSC_EXPORT_API void qsc_keccak_absorb | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | message, | ||
| size_t | msglen, | ||
| uint8_t | domain, | ||
| size_t | rounds ) |
Absorb an input message into the Keccak state.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| message | [const uint8_t*] The input message byte array |
| msglen | [size_t] The number of message bytes to process |
| domain | [uint8_t] The function domain id |
| rounds | [size_t] The number of permutation rounds, the default is 24, maximum is 48 |
| QSC_EXPORT_API void qsc_keccak_absorb_custom | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | custom, | ||
| size_t | custlen, | ||
| const uint8_t * | name, | ||
| size_t | namelen, | ||
| size_t | rounds ) |
Absorb the custom, and name arrays into the Keccak state.
| ctx | [qsc_keccak_state*] The Keccak state structure |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| name | [const uint8_t*] The function name string |
| namelen | [size_t] The byte length of the function name |
| rounds | [size_t] The number of permutation rounds, the default is 24, maximum is 48 |
| QSC_EXPORT_API void qsc_keccak_absorb_key_custom | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen, | ||
| const uint8_t * | name, | ||
| size_t | namelen, | ||
| size_t | rounds ) |
Absorb the custom, name, and key arrays into the Keccak state.
| ctx | [qsc_keccak_state*] The Keccak state structure |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| name | [const uint8_t*] The function name string |
| namelen | [size_t] The byte length of the function name |
| rounds | [size_t] The number of permutation rounds, the default is 24, maximum is 48 |
| QSC_EXPORT_API void qsc_keccak_dispose | ( | qsc_keccak_state * | ctx | ) |
Dispose of the Keccak state.
| ctx | [qsc_keccak_state*] The Keccak state structure |
| QSC_EXPORT_API void qsc_keccak_finalize | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| uint8_t * | output, | ||
| size_t | outlen, | ||
| uint8_t | domain, | ||
| size_t | rounds ) |
Finalize the Keccak state.
| ctx | [qsc_keccak_state*] The Keccak state structure |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| domain | [size_t] The function domain id |
| rounds | [size_t] The number of permutation rounds, the default is 24, maximum is 48 |
| QSC_EXPORT_API void qsc_keccak_incremental_absorb | ( | qsc_keccak_state * | ctx, |
| uint32_t | rate, | ||
| const uint8_t * | message, | ||
| size_t | msglen ) |
Absorb bytes into state incrementally.
| ctx | [qsc_keccak_state*] The function state |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| message | [const uint8_t*] The input message array |
| msglen | [size_t] The number of message bytes |
| QSC_EXPORT_API void qsc_keccak_incremental_finalize | ( | qsc_keccak_state * | ctx, |
| uint32_t | rate, | ||
| uint8_t | domain ) |
Finalize state added incrementally.
| ctx | [qsc_keccak_state*] The function state |
| rate | [uint32_t] The rate of absorption in bytes |
| domain | [uint8_t] The function domain id |
| QSC_EXPORT_API void qsc_keccak_incremental_squeeze | ( | qsc_keccak_state * | ctx, |
| size_t | rate, | ||
| uint8_t * | output, | ||
| size_t | outlen ) |
Extract an array of bytes from the Keccak state.
| ctx | [qsc_keccak_state*] The function state |
| rate | [size_t] The rate of absorption in bytes |
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| QSC_EXPORT_API void qsc_keccak_initialize_state | ( | qsc_keccak_state * | ctx | ) |
Initializes a Keccak state structure, must be called before message processing. Long form api: must be used in conjunction with the block-update and finalize functions.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| QSC_EXPORT_API void qsc_keccak_permute | ( | qsc_keccak_state * | ctx, |
| size_t | rounds ) |
The Keccak permute function. Internal function: Permutes the state array, can be used in external constructions.
| ctx | [qsc_keccak_state*] The function state; must be initialized |
| rounds | [size_t] The number of permutation rounds, the default and maximum is 24 |
| QSC_EXPORT_API void qsc_keccak_permute_p1600c | ( | uint64_t * | state, |
| size_t | rounds ) |
The compact Keccak permute function. Internal function: Permutes the state array, can be used in external constructions.
| state | [uint64_t*] The state array; must be initialized |
| rounds | [size_t] The number of permutation rounds, the default and maximum is 24 |
| QSC_EXPORT_API void qsc_keccak_permute_p1600u | ( | uint64_t * | state | ) |
The unrolled Keccak permute function. Internal function: Permutes the state array, can be used in external constructions.
| state | [uint64_t*] The state array; must be initialized |
| QSC_EXPORT_API void qsc_keccak_squeezeblocks | ( | qsc_keccak_state * | ctx, |
| uint8_t * | output, | ||
| size_t | nblocks, | ||
| qsc_keccak_rate | rate, | ||
| size_t | rounds ) |
The Keccak squeeze function.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| output | [uint8_t*] The output byte array |
| nblocks | [size_t] The number of blocks to extract |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| rounds | [size_t] The number of permutation rounds, the default and maximum is 24 |
| QSC_EXPORT_API void qsc_keccak_update | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | message, | ||
| size_t | msglen, | ||
| size_t | rounds ) |
Update Keccak state with message input.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| message | [const uint8_t*] The input message byte array |
| msglen | [size_t] The number of message bytes to process |
| rounds | [size_t] The number of permutation rounds, the default and maximum is 24 |
| QSC_EXPORT_API void qsc_kmac128_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | message, | ||
| size_t | msglen, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Key a KMAC-128 instance and generate a MAC code. Short form api: processes the key and custom inputs and generates the MAC code with a single call. Key the MAC generator process a message and output the MAC code.
| output | [uint8_t*] The MAC code byte array |
| outlen | [size_t] The number of MAC code bytes to generate |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_kmac256_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | message, | ||
| size_t | msglen, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Key a KMAC-256 instance and generate a MAC code. Short form api: processes the key and custom inputs and generates the MAC code with a single call. Key the MAC generator process a message and output the MAC code.
| output | [uint8_t*] The MAC code byte array |
| outlen | [size_t] The number of MAC code bytes to generate |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_kmac512_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | message, | ||
| size_t | msglen, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Key a KMAC-512 instance and generate a MAC code. Short form api: processes the key and custom inputs and generates the MAC code with a single call. Key the MAC generator process a message and output the MAC code.
| output | [uint8_t*] The MAC code byte array |
| outlen | [size_t] The number of MAC code bytes to generate |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_kmac_128x4 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| size_t | outlen, | ||
| const uint8_t * | key0, | ||
| const uint8_t * | key1, | ||
| const uint8_t * | key2, | ||
| const uint8_t * | key3, | ||
| size_t | keylen, | ||
| const uint8_t * | cst0, | ||
| const uint8_t * | cst1, | ||
| const uint8_t * | cst2, | ||
| const uint8_t * | cst3, | ||
| size_t | cstlen, | ||
| const uint8_t * | msg0, | ||
| const uint8_t * | msg1, | ||
| const uint8_t * | msg2, | ||
| const uint8_t * | msg3, | ||
| size_t | msglen ) |
Process 4 KMAC-128 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| outlen | [uint8_t*] The length of the output arrays |
| key0 | [const uint8_t*] The 1st key array |
| key1 | [const uint8_t*] The 2nd key array |
| key2 | [const uint8_t*] The 3rd key array |
| key3 | [const uint8_t*] The 4th key array |
| keylen | [size_t] The length of the input key arrays |
| cst0 | [const uint8_t*] The 1st custom array |
| cst1 | [const uint8_t*] The 2nd custom array |
| cst2 | [const uint8_t*] The 3rd custom array |
| cst3 | [const uint8_t*] The 4th custom array |
| cstlen | [size_t] The length of the custom arrays |
| msg0 | [const uint8_t*] The 1st message array |
| msg1 | [const uint8_t*] The 2nd message array |
| msg2 | [const uint8_t*] The 3rd message array |
| msg3 | [const uint8_t*] The 4th message array |
| msglen | [size_t] The length of the message arrays |
| QSC_EXPORT_API void qsc_kmac_128x8 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| uint8_t * | out4, | ||
| uint8_t * | out5, | ||
| uint8_t * | out6, | ||
| uint8_t * | out7, | ||
| size_t | outlen, | ||
| const uint8_t * | key0, | ||
| const uint8_t * | key1, | ||
| const uint8_t * | key2, | ||
| const uint8_t * | key3, | ||
| const uint8_t * | key4, | ||
| const uint8_t * | key5, | ||
| const uint8_t * | key6, | ||
| const uint8_t * | key7, | ||
| size_t | keylen, | ||
| const uint8_t * | cst0, | ||
| const uint8_t * | cst1, | ||
| const uint8_t * | cst2, | ||
| const uint8_t * | cst3, | ||
| const uint8_t * | cst4, | ||
| const uint8_t * | cst5, | ||
| const uint8_t * | cst6, | ||
| const uint8_t * | cst7, | ||
| size_t | cstlen, | ||
| const uint8_t * | msg0, | ||
| const uint8_t * | msg1, | ||
| const uint8_t * | msg2, | ||
| const uint8_t * | msg3, | ||
| const uint8_t * | msg4, | ||
| const uint8_t * | msg5, | ||
| const uint8_t * | msg6, | ||
| const uint8_t * | msg7, | ||
| size_t | msglen ) |
Process 8 KMAC-128 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| out4 | [uint8_t*] The 5th output array |
| out5 | [uint8_t*] The 6th output array |
| out6 | [uint8_t*] The 7th output array |
| out7 | [uint8_t*] The 8th output array |
| outlen | [size_t] The length of the output arrays |
| key0 | [const uint8_t*] The 1st key array |
| key1 | [const uint8_t*] The 2nd key array |
| key2 | [const uint8_t*] The 3rd key array |
| key3 | [const uint8_t*] The 4th key array |
| key4 | [const uint8_t*] The 5th key array |
| key5 | [const uint8_t*] The 6th key array |
| key6 | [const uint8_t* The 7th key array |
| key7 | [const uint8_t*] The 8th key array |
| keylen | [size_t] The length of the key arrays |
| cst0 | [const uint8_t*] The 1st custom array |
| cst1 | [const uint8_t*] The 2nd custom array |
| cst2 | [const uint8_t*] The 3rd custom array |
| cst3 | [const uint8_t*] The 4th custom array |
| cst4 | [const uint8_t*] The 5th custom array |
| cst5 | [const uint8_t*] The 6th custom array |
| cst6 | [const uint8_t*] The 7th custom array |
| cst7 | [const uint8_t*] The 8th custom array |
| cstlen | [size_t] The length of the custom arrays |
| msg0 | [const uint8_t* The 1st message array |
| msg1 | [const uint8_t*] The 2nd message array |
| msg2 | [const uint8_t*] The 3rd message array |
| msg3 | [const uint8_t*] The 4th message array |
| msg4 | [const uint8_t*] The 5th message array |
| msg5 | [const uint8_t*] The 6th message array |
| msg6 | [const uint8_t*] The 7th message array |
| msg7 | [const uint8_t*] The 8th message array |
| msglen | [size_t] The length of the message arrays |
| QSC_EXPORT_API void qsc_kmac_256x4 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| size_t | outlen, | ||
| const uint8_t * | key0, | ||
| const uint8_t * | key1, | ||
| const uint8_t * | key2, | ||
| const uint8_t * | key3, | ||
| size_t | keylen, | ||
| const uint8_t * | cst0, | ||
| const uint8_t * | cst1, | ||
| const uint8_t * | cst2, | ||
| const uint8_t * | cst3, | ||
| size_t | cstlen, | ||
| const uint8_t * | msg0, | ||
| const uint8_t * | msg1, | ||
| const uint8_t * | msg2, | ||
| const uint8_t * | msg3, | ||
| size_t | msglen ) |
Process 4 KMAC-256 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| outlen | [uint8_t*] The length of the output arrays |
| key0 | [const uint8_t*] The 1st key array |
| key1 | [const uint8_t*] The 2nd key array |
| key2 | [const uint8_t*] The 3rd key array |
| key3 | [const uint8_t*] The 4th key array |
| keylen | [size_t] The length of the input key arrays |
| cst0 | [const uint8_t*] The 1st custom array |
| cst1 | [const uint8_t*] The 2nd custom array |
| cst2 | [const uint8_t*] The 3rd custom array |
| cst3 | [const uint8_t*] The 4th custom array |
| cstlen | [size_t] The length of the custom arrays |
| msg0 | [const uint8_t*] The 1st message array |
| msg1 | [const uint8_t*] The 2nd message array |
| msg2 | [const uint8_t*] The 3rd message array |
| msg3 | [const uint8_t*] The 4th message array |
| msglen | [size_t] The length of the message arrays |
| QSC_EXPORT_API void qsc_kmac_256x8 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| uint8_t * | out4, | ||
| uint8_t * | out5, | ||
| uint8_t * | out6, | ||
| uint8_t * | out7, | ||
| size_t | outlen, | ||
| const uint8_t * | key0, | ||
| const uint8_t * | key1, | ||
| const uint8_t * | key2, | ||
| const uint8_t * | key3, | ||
| const uint8_t * | key4, | ||
| const uint8_t * | key5, | ||
| const uint8_t * | key6, | ||
| const uint8_t * | key7, | ||
| size_t | keylen, | ||
| const uint8_t * | cst0, | ||
| const uint8_t * | cst1, | ||
| const uint8_t * | cst2, | ||
| const uint8_t * | cst3, | ||
| const uint8_t * | cst4, | ||
| const uint8_t * | cst5, | ||
| const uint8_t * | cst6, | ||
| const uint8_t * | cst7, | ||
| size_t | cstlen, | ||
| const uint8_t * | msg0, | ||
| const uint8_t * | msg1, | ||
| const uint8_t * | msg2, | ||
| const uint8_t * | msg3, | ||
| const uint8_t * | msg4, | ||
| const uint8_t * | msg5, | ||
| const uint8_t * | msg6, | ||
| const uint8_t * | msg7, | ||
| size_t | msglen ) |
Process 8 KMAC-256 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| out4 | [uint8_t*] The 5th output array |
| out5 | [uint8_t*] The 6th output array |
| out6 | [uint8_t*] The 7th output array |
| out7 | [uint8_t*] The 8th output array |
| outlen | [size_t] The length of the output arrays |
| key0 | [const uint8_t*] The 1st key array |
| key1 | [const uint8_t*] The 2nd key array |
| key2 | [const uint8_t*] The 3rd key array |
| key3 | [const uint8_t*] The 4th key array |
| key4 | [const uint8_t*] The 5th key array |
| key5 | [const uint8_t*] The 6th key array |
| key6 | [const uint8_t* The 7th key array |
| key7 | [const uint8_t*] The 8th key array |
| keylen | [size_t] The length of the key arrays |
| cst0 | [const uint8_t*] The 1st custom array |
| cst1 | [const uint8_t*] The 2nd custom array |
| cst2 | [const uint8_t*] The 3rd custom array |
| cst3 | [const uint8_t*] The 4th custom array |
| cst4 | [const uint8_t*] The 5th custom array |
| cst5 | [const uint8_t*] The 6th custom array |
| cst6 | [const uint8_t*] The 7th custom array |
| cst7 | [const uint8_t*] The 8th custom array |
| cstlen | [size_t] The length of the custom arrays |
| msg0 | [const uint8_t* The 1st message array |
| msg1 | [const uint8_t*] The 2nd message array |
| msg2 | [const uint8_t*] The 3rd message array |
| msg3 | [const uint8_t*] The 4th message array |
| msg4 | [const uint8_t*] The 5th message array |
| msg5 | [const uint8_t*] The 6th message array |
| msg6 | [const uint8_t*] The 7th message array |
| msg7 | [const uint8_t*] The 8th message array |
| msglen | [size_t] The length of the message arrays |
| QSC_EXPORT_API void qsc_kmac_512x4 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| size_t | outlen, | ||
| const uint8_t * | key0, | ||
| const uint8_t * | key1, | ||
| const uint8_t * | key2, | ||
| const uint8_t * | key3, | ||
| size_t | keylen, | ||
| const uint8_t * | cst0, | ||
| const uint8_t * | cst1, | ||
| const uint8_t * | cst2, | ||
| const uint8_t * | cst3, | ||
| size_t | cstlen, | ||
| const uint8_t * | msg0, | ||
| const uint8_t * | msg1, | ||
| const uint8_t * | msg2, | ||
| const uint8_t * | msg3, | ||
| size_t | msglen ) |
Process 4 KMAC-512 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| outlen | [uint8_t*] The length of the output arrays |
| key0 | [const uint8_t*] The 1st key array |
| key1 | [const uint8_t*] The 2nd key array |
| key2 | [const uint8_t*] The 3rd key array |
| key3 | [const uint8_t*] The 4th key array |
| keylen | [size_t] The length of the input key arrays |
| cst0 | [const uint8_t*] The 1st custom array |
| cst1 | [const uint8_t*] The 2nd custom array |
| cst2 | [const uint8_t*] The 3rd custom array |
| cst3 | [const uint8_t*] The 4th custom array |
| cstlen | [size_t] The length of the custom arrays |
| msg0 | [const uint8_t*] The 1st message array |
| msg1 | [const uint8_t*] The 2nd message array |
| msg2 | [const uint8_t*] The 3rd message array |
| msg3 | [const uint8_t*] The 4th message array |
| msglen | [size_t] The length of the message arrays |
| QSC_EXPORT_API void qsc_kmac_512x8 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| uint8_t * | out4, | ||
| uint8_t * | out5, | ||
| uint8_t * | out6, | ||
| uint8_t * | out7, | ||
| size_t | outlen, | ||
| const uint8_t * | key0, | ||
| const uint8_t * | key1, | ||
| const uint8_t * | key2, | ||
| const uint8_t * | key3, | ||
| const uint8_t * | key4, | ||
| const uint8_t * | key5, | ||
| const uint8_t * | key6, | ||
| const uint8_t * | key7, | ||
| size_t | keylen, | ||
| const uint8_t * | cst0, | ||
| const uint8_t * | cst1, | ||
| const uint8_t * | cst2, | ||
| const uint8_t * | cst3, | ||
| const uint8_t * | cst4, | ||
| const uint8_t * | cst5, | ||
| const uint8_t * | cst6, | ||
| const uint8_t * | cst7, | ||
| size_t | cstlen, | ||
| const uint8_t * | msg0, | ||
| const uint8_t * | msg1, | ||
| const uint8_t * | msg2, | ||
| const uint8_t * | msg3, | ||
| const uint8_t * | msg4, | ||
| const uint8_t * | msg5, | ||
| const uint8_t * | msg6, | ||
| const uint8_t * | msg7, | ||
| size_t | msglen ) |
Process 8 KMAC-512 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| out4 | [uint8_t*] The 5th output array |
| out5 | [uint8_t*] The 6th output array |
| out6 | [uint8_t*] The 7th output array |
| out7 | [uint8_t*] The 8th output array |
| outlen | [size_t] The length of the output arrays |
| key0 | [const uint8_t*] The 1st key array |
| key1 | [const uint8_t*] The 2nd key array |
| key2 | [const uint8_t*] The 3rd key array |
| key3 | [const uint8_t*] The 4th key array |
| key4 | [const uint8_t*] The 5th key array |
| key5 | [const uint8_t*] The 6th key array |
| key6 | [const uint8_t* The 7th key array |
| key7 | [const uint8_t*] The 8th key array |
| keylen | [size_t] The length of the key arrays |
| cst0 | [const uint8_t*] The 1st custom array |
| cst1 | [const uint8_t*] The 2nd custom array |
| cst2 | [const uint8_t*] The 3rd custom array |
| cst3 | [const uint8_t*] The 4th custom array |
| cst4 | [const uint8_t*] The 5th custom array |
| cst5 | [const uint8_t*] The 6th custom array |
| cst6 | [const uint8_t*] The 7th custom array |
| cst7 | [const uint8_t*] The 8th custom array |
| cstlen | [size_t] The length of the custom arrays |
| msg0 | [const uint8_t* The 1st message array |
| msg1 | [const uint8_t*] The 2nd message array |
| msg2 | [const uint8_t*] The 3rd message array |
| msg3 | [const uint8_t*] The 4th message array |
| msg4 | [const uint8_t*] The 5th message array |
| msg5 | [const uint8_t*] The 6th message array |
| msg6 | [const uint8_t*] The 7th message array |
| msg7 | [const uint8_t*] The 8th message array |
| msglen | [size_t] The length of the message arrays |
| QSC_EXPORT_API void qsc_kmac_finalize | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| uint8_t * | output, | ||
| size_t | outlen ) |
The KMAC finalize function. Long form api: must be used in conjunction with the initialize and blockupdate functions. Final processing and calculation of the MAC code.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of bytes to extract |
| QSC_EXPORT_API void qsc_kmac_initialize | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Initialize a KMAC instance. Long form api: must be used in conjunction with the blockupdate and finalize functions. Key the MAC generator and initialize the internal state.
| ctx | [qsc_keccak_state*] A reference to the keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_kmac_update | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | message, | ||
| size_t | msglen ) |
The KMAC message update function. Long form api: must be used in conjunction with the initialize and finalize functions.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| QSC_EXPORT_API void qsc_kpa_dispose | ( | qsc_kpa_state * | ctx | ) |
Dispose of the KPA state.
| ctx | [qsc_kpa_state*] A reference to the KPA state structure; must be initialized |
| QSC_EXPORT_API void qsc_kpa_finalize | ( | qsc_kpa_state * | ctx, |
| uint8_t * | output, | ||
| size_t | outlen ) |
The KPA finalize function. Long form api: must be used in conjunction with the initialize and blockupdate functions. Final processing and calculation of the MAC code.
| ctx | [qsc_kpa_state*] A reference to the KPA state structure; must be initialized |
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of bytes to extract |
| QSC_EXPORT_API void qsc_kpa_initialize | ( | qsc_kpa_state * | ctx, |
| const uint8_t * | key, | ||
| size_t | keylen, | ||
| const uint8_t * | custom, | ||
| size_t | custlen ) |
Initialize a KPA instance. Long form api: must be used in conjunction with the blockupdate and finalize functions. Key the MAC generator and initialize the internal state.
| ctx | [qsc_kpa_state*] A reference to the KPA state structure; must be initialized |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| custom | [const uint8_t*] The customization string |
| custlen | [size_t] The byte length of the customization string |
| QSC_EXPORT_API void qsc_kpa_update | ( | qsc_kpa_state * | ctx, |
| const uint8_t * | message, | ||
| size_t | msglen ) |
The KPA message update function. Long form api: must be used in conjunction with the initialize and finalize functions.
| ctx | [qsc_kpa_state*] A reference to the KPA state structure; must be initialized |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| QSC_EXPORT_API void qsc_sha3_compute128 | ( | uint8_t * | output, |
| const uint8_t * | message, | ||
| size_t | msglen ) |
Process a message with SHA3-128 and return the hash code in the output byte array. Short form api: processes the entire message and computes the hash code with a single call.
| output | [uint8_t*] The output byte array; receives the hash code |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| QSC_EXPORT_API void qsc_sha3_compute256 | ( | uint8_t * | output, |
| const uint8_t * | message, | ||
| size_t | msglen ) |
Process a message with SHA3-256 and return the hash code in the output byte array. Short form api: processes the entire message and computes the hash code with a single call.
| output | [uint8_t*] The output byte array; receives the hash code |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| QSC_EXPORT_API void qsc_sha3_compute512 | ( | uint8_t * | output, |
| const uint8_t * | message, | ||
| size_t | msglen ) |
Process a message with SHA3-512 and return the hash code in the output byte array. Short form api: processes the entire message and computes the hash code with a single call.
| output | [uint8_t*] The output byte array; receives the hash code |
| message | [const uint8_t*] The message input byte array |
| msglen | [size_t] The number of message bytes to process |
| QSC_EXPORT_API void qsc_sha3_finalize | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| uint8_t * | output ) |
Finalize the message state and returns the hash value in output. Long form api: must be used in conjunction with the initialize and block-update functions. Absorb the last block of message and create the hash value. Produces a 32 byte output code using QSC_KECCAK_256_RATE, 64 bytes with QSC_KECCAK_512_RATE.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| output | [uint8_t*] The output byte array; receives the hash code |
| QSC_EXPORT_API void qsc_sha3_initialize | ( | qsc_keccak_state * | ctx | ) |
Initialize the SHA3 state Long form api: Must be called before the update or finalize functions are called.
| ctx | [qsc_keccak_state*] A reference to the Keccak state |
| QSC_EXPORT_API void qsc_sha3_update | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | message, | ||
| size_t | msglen ) |
Update SHA3 with message input. Long form api: must be used in conjunction with the initialize and finalize functions. Absorbs the input message into the state.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| message | [const uint8_t*] The input message byte array |
| msglen | [size_t] The number of message bytes to process |
| QSC_EXPORT_API void qsc_shake128_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| size_t | keylen ) |
Key a SHAKE-128 instance, and generate an array of pseudo-random bytes. Short form api: processes the key and generates the pseudo-random output with a single call.
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| QSC_EXPORT_API void qsc_shake256_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| size_t | keylen ) |
Key a SHAKE-256 instance, and generate an array of pseudo-random bytes. Short form api: processes the key and generates the pseudo-random output with a single call.
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| QSC_EXPORT_API void qsc_shake512_compute | ( | uint8_t * | output, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| size_t | keylen ) |
Key a SHAKE-512 instance, and generate an array of pseudo-random bytes. Short form api: processes the key and generates the pseudo-random output with a single call.
| output | [uint8_t*] The output byte array |
| outlen | [size_t] The number of output bytes to generate |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| QSC_EXPORT_API void qsc_shake_128x4 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| size_t | outlen, | ||
| const uint8_t * | inp0, | ||
| const uint8_t * | inp1, | ||
| const uint8_t * | inp2, | ||
| const uint8_t * | inp3, | ||
| size_t | inplen ) |
Process 4 SHAKE-128 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| outlen | [size_t] The length of the output arrays |
| inp0 | [const uint8_t*] The 1st input key array |
| inp1 | [const uint8_t*] The 2nd input key array |
| inp2 | [const uint8_t*] The 3rd input key array |
| inp3 | [const uint8_t*] The 4th input key array |
| inplen | [size_t] The length of the input key arrays |
| QSC_EXPORT_API void qsc_shake_128x8 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| uint8_t * | out4, | ||
| uint8_t * | out5, | ||
| uint8_t * | out6, | ||
| uint8_t * | out7, | ||
| size_t | outlen, | ||
| const uint8_t * | inp0, | ||
| const uint8_t * | inp1, | ||
| const uint8_t * | inp2, | ||
| const uint8_t * | inp3, | ||
| const uint8_t * | inp4, | ||
| const uint8_t * | inp5, | ||
| const uint8_t * | inp6, | ||
| const uint8_t * | inp7, | ||
| size_t | inplen ) |
Process 8 SHAKE-128 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| out4 | [uint8_t*] The 5th output array |
| out5 | [uint8_t*] The 6th output array |
| out6 | [uint8_t*] The 7th output array |
| out7 | [uint8_t*] The 8th output array |
| outlen | [size_t] The length of the output arrays |
| inp0 | [const uint8_t*] The 1st input key array |
| inp1 | [const uint8_t*] The 2nd input key array |
| inp2 | [const uint8_t*] The 3rd input key array |
| inp3 | [const uint8_t*] The 4th input key array |
| inp4 | [const uint8_t*] The 5th input key array |
| inp5 | [const uint8_t*] The 6th input key array |
| inp6 | [const uint8_t*] The 7th input key array |
| inp7 | [const uint8_t*] The 8th input key array |
| inplen | [size_t] The length of the input key arrays |
| QSC_EXPORT_API void qsc_shake_256x4 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| size_t | outlen, | ||
| const uint8_t * | inp0, | ||
| const uint8_t * | inp1, | ||
| const uint8_t * | inp2, | ||
| const uint8_t * | inp3, | ||
| size_t | inplen ) |
Process 4 SHAKE-256 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| outlen | [size_t] The length of the output arrays |
| inp0 | [const uint8_t*] The 1st input key array |
| inp1 | [const uint8_t*] The 2nd input key array |
| inp2 | [const uint8_t*] The 3rd input key array |
| inp3 | [const uint8_t*] The 4th input key array |
| inplen | [size_t] The length of the input key arrays |
| QSC_EXPORT_API void qsc_shake_256x8 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| uint8_t * | out4, | ||
| uint8_t * | out5, | ||
| uint8_t * | out6, | ||
| uint8_t * | out7, | ||
| size_t | outlen, | ||
| const uint8_t * | inp0, | ||
| const uint8_t * | inp1, | ||
| const uint8_t * | inp2, | ||
| const uint8_t * | inp3, | ||
| const uint8_t * | inp4, | ||
| const uint8_t * | inp5, | ||
| const uint8_t * | inp6, | ||
| const uint8_t * | inp7, | ||
| size_t | inplen ) |
Process 8 SHAKE-256 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| out4 | [uint8_t*] The 5th output array |
| out5 | [uint8_t*] The 6th output array |
| out6 | [uint8_t*] The 7th output array |
| out7 | [uint8_t*] The 8th output array |
| outlen | [size_t] The length of the output arrays |
| inp0 | [const uint8_t*] The 1st input key array |
| inp1 | [const uint8_t*] The 2nd input key array |
| inp2 | [const uint8_t*] The 3rd input key array |
| inp3 | [const uint8_t*] The 4th input key array |
| inp4 | [const uint8_t*] The 5th input key array |
| inp5 | [const uint8_t*] The 6th input key array |
| inp6 | [const uint8_t*] The 7th input key array |
| inp7 | [const uint8_t*] The 8th input key array |
| inplen | [size_t] The length of the input key arrays |
| QSC_EXPORT_API void qsc_shake_512x4 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| size_t | outlen, | ||
| const uint8_t * | inp0, | ||
| const uint8_t * | inp1, | ||
| const uint8_t * | inp2, | ||
| const uint8_t * | inp3, | ||
| size_t | inplen ) |
Process 4 SHAKE-512 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] The 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| outlen | [size_t] The length of the output arrays |
| inp0 | [const uint8_t*] The 1st input key array |
| inp1 | [const uint8_t*] The 2nd input key array |
| inp2 | [const uint8_t*] The 3rd input key array |
| inp3 | [const uint8_t*] The 4th input key array |
| inplen | [size_t] The length of the input key arrays |
| QSC_EXPORT_API void qsc_shake_512x8 | ( | uint8_t * | out0, |
| uint8_t * | out1, | ||
| uint8_t * | out2, | ||
| uint8_t * | out3, | ||
| uint8_t * | out4, | ||
| uint8_t * | out5, | ||
| uint8_t * | out6, | ||
| uint8_t * | out7, | ||
| size_t | outlen, | ||
| const uint8_t * | inp0, | ||
| const uint8_t * | inp1, | ||
| const uint8_t * | inp2, | ||
| const uint8_t * | inp3, | ||
| const uint8_t * | inp4, | ||
| const uint8_t * | inp5, | ||
| const uint8_t * | inp6, | ||
| const uint8_t * | inp7, | ||
| size_t | inplen ) |
Process 8 SHAKE-512 instances simultaneously using SIMD instructions.
| out0 | [uint8_t*] The 1st output array |
| out1 | [uint8_t*] 2nd output array |
| out2 | [uint8_t*] The 3rd output array |
| out3 | [uint8_t*] The 4th output array |
| out4 | [uint8_t*] The 5th output array |
| out5 | [uint8_t*] The 6th output array |
| out6 | [uint8_t*] The 7th output array |
| out7 | [uint8_t*] The 8th output array |
| outlen | [size_t] The length of the output arrays |
| inp0 | [const uint8_t*] The 1st input key array |
| inp1 | [const uint8_t*] The 2nd input key array |
| inp2 | [const uint8_t*] The 3rd input key array |
| inp3 | [const uint8_t*] The 4th input key array |
| inp4 | [const uint8_t*] The 5th input key array |
| inp5 | [const uint8_t*] The 6th input key array |
| inp6 | [const uint8_t*] The 7th input key array |
| inp7 | [const uint8_t*] The 8th input key array |
| inplen | [size_t] The length of the input key arrays |
| QSC_EXPORT_API void qsc_shake_initialize | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| const uint8_t * | key, | ||
| size_t | keylen ) |
The SHAKE initialize function. Long form api: must be used in conjunction with the squeezeblocks function. Absorb and finalize an input key byte array.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| key | [const uint8_t*] The input key byte array |
| keylen | [size_t] The number of key bytes to process |
| QSC_EXPORT_API void qsc_shake_squeezeblocks | ( | qsc_keccak_state * | ctx, |
| qsc_keccak_rate | rate, | ||
| uint8_t * | output, | ||
| size_t | nblocks ) |
The SHAKE squeeze function. Long form api: must be used in conjunction with the initialize function. Permutes and extracts the state to an output byte array.
| ctx | [qsc_keccak_state*] A reference to the Keccak state; must be initialized |
| rate | [qsc_keccak_rate] The rate of absorption in bytes |
| output | [uint8_t*] The output byte array |
| nblocks | [size_t] The number of blocks to extract |