Implementation of the SHA-3 hashing function. More...
Implementation of the SHA-3 hashing function.
Files | |
| file | sha3.h | 
| Header definitions for the SHA-3 hash function.  | |
Data Structures | |
| struct | keccak_state_t | 
| Context for operations on a sponge with keccak permutation.  More... | |
Macros | |
| #define | SHA3_256_DIGEST_LENGTH 32 | 
| Length of SHA3-256 digests in bytes.  | |
| #define | SHA3_384_DIGEST_LENGTH 48 | 
| Length of SHA3-384 digests in bytes.  | |
| #define | SHA3_512_DIGEST_LENGTH 64 | 
| Length of SHA3-512 digests in bytes.  | |
Functions | |
| void | Keccak_init (keccak_state_t *ctx, unsigned int rate, unsigned int capacity, unsigned char delimitedSuffix) | 
| Initialise a sponge based on a keccak-1600 permutation.  More... | |
| void | Keccak_update (keccak_state_t *ctx, const unsigned char *input, unsigned long long int inputByteLen) | 
| Absorbs data into a sponge.  More... | |
| void | Keccak_final (keccak_state_t *ctx, unsigned char *output, unsigned long long int outputByteLen) | 
| Squeeze data from a sponge.  More... | |
| void | sha3_256_init (keccak_state_t *ctx) | 
| SHA3-256 initialization.  More... | |
| void | sha3_update (keccak_state_t *ctx, const void *data, size_t len) | 
| Add bytes into the hash.  More... | |
| void | sha3_256_final (keccak_state_t *ctx, void *digest) | 
| SHA3-256 finalization.  More... | |
| void | sha3_384_init (keccak_state_t *ctx) | 
| SHA3-384 initialization.  More... | |
| void | sha3_384_final (keccak_state_t *ctx, void *digest) | 
| SHA3-384 finalization.  More... | |
| void | sha3_512_init (keccak_state_t *ctx) | 
| SHA3-512 initialization.  More... | |
| void | sha3_512_final (keccak_state_t *ctx, void *digest) | 
| SHA3-512 finalization.  More... | |
| void | sha3_256 (void *digest, const void *data, size_t len) | 
| A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-256 from one buffer.  More... | |
| void | sha3_384 (void *digest, const void *data, size_t len) | 
| A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-384 from one buffer.  More... | |
| void | sha3_512 (void *digest, const void *data, size_t len) | 
| A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-512 from one buffer.  More... | |
| void Keccak_final | ( | keccak_state_t * | ctx, | 
| unsigned char * | output, | ||
| unsigned long long int | outputByteLen | ||
| ) | 
Squeeze data from a sponge.
| [in,out] | ctx | context handle of the sponge | 
| [out] | output | the squeezed data | 
| [in] | outputByteLen | size of the data to be squeezed. | 
| void Keccak_init | ( | keccak_state_t * | ctx, | 
| unsigned int | rate, | ||
| unsigned int | capacity, | ||
| unsigned char | delimitedSuffix | ||
| ) | 
Initialise a sponge based on a keccak-1600 permutation.
| [out] | ctx | context handle to initialise | 
| [in] | rate | the desired rate of the sponge | 
| [in] | capacity | the desired capacity of the sponge | 
| [in] | delimitedSuffix | suffix to be appended to the message after the absorbation phase | 
| void Keccak_update | ( | keccak_state_t * | ctx, | 
| const unsigned char * | input, | ||
| unsigned long long int | inputByteLen | ||
| ) | 
Absorbs data into a sponge.
Can be called multiple times
| [in,out] | ctx | context handle of the sponge | 
| [in] | input | pointer to the data to be absorbed | 
| [in] | inputByteLen | length of the input data in bytes | 
| void sha3_256 | ( | void * | digest, | 
| const void * | data, | ||
| size_t | len | ||
| ) | 
A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-256 from one buffer.
| [in] | data | pointer to the buffer to generate hash from | 
| [in] | len | length of the buffer | 
| [out] | digest | pointer to an array for the result, length must be SHA3_256_DIGEST_LENGTH | 
| void sha3_256_final | ( | keccak_state_t * | ctx, | 
| void * | digest | ||
| ) | 
SHA3-256 finalization.
Pads the input data and exports the hash value
| [in,out] | ctx | context handle to use | 
| [out] | digest | resulting digest, this is the hash of all the bytes | 
| void sha3_256_init | ( | keccak_state_t * | ctx | ) | 
SHA3-256 initialization.
Begins a SHA3-256 operation.
| [in] | ctx | keccak_state_t handle to initialise | 
| void sha3_384 | ( | void * | digest, | 
| const void * | data, | ||
| size_t | len | ||
| ) | 
A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-384 from one buffer.
| [in] | data | pointer to the buffer to generate hash from | 
| [in] | len | length of the buffer | 
| [out] | digest | pointer to an array for the result, length must be SHA3_384_DIGEST_LENGTH | 
| void sha3_384_final | ( | keccak_state_t * | ctx, | 
| void * | digest | ||
| ) | 
SHA3-384 finalization.
Pads the input data and exports the hash value
| [in,out] | ctx | context handle to use | 
| [out] | digest | resulting digest, this is the hash of all the bytes | 
| void sha3_384_init | ( | keccak_state_t * | ctx | ) | 
SHA3-384 initialization.
Begins a SHA3-384 operation.
| [in] | ctx | keccak_state_t handle to initialise | 
| void sha3_512 | ( | void * | digest, | 
| const void * | data, | ||
| size_t | len | ||
| ) | 
A wrapper function to simplify the generation of a hash, this is useful for generating SHA3-512 from one buffer.
| [in] | data | pointer to the buffer to generate hash from | 
| [in] | len | length of the buffer | 
| [out] | digest | pointer to an array for the result, length must be SHA3_512_DIGEST_LENGTH | 
| void sha3_512_final | ( | keccak_state_t * | ctx, | 
| void * | digest | ||
| ) | 
SHA3-512 finalization.
Pads the input data and exports the hash value
| [in,out] | ctx | context handle to use | 
| [out] | digest | resulting digest, this is the hash of all the bytes | 
| void sha3_512_init | ( | keccak_state_t * | ctx | ) | 
SHA3-512 initialization.
Begins a SHA3-512 operation.
| [in] | ctx | keccak_state_t handle to initialise | 
| void sha3_update | ( | keccak_state_t * | ctx, | 
| const void * | data, | ||
| size_t | len | ||
| ) | 
Add bytes into the hash.
| [in,out] | ctx | context handle to use | 
| [in] | data | Input data | 
| [in] | len | Length of data  |