sha3
Embeddable C11 SHA-3 implementation.
|
Hash function and XOF, as defined in section 6 of SP 800-185. More...
Data Structures | |
struct | parallelhash_params_t |
ParallelHash configuration parameters. More... | |
struct | parallelhash_t |
ParallelHash context (all members are private). More... | |
Functions | |
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. More... | |
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. More... | |
void | parallelhash128_xof_init (parallelhash_t *xof, const parallelhash_params_t params) |
Initialize a ParallelHash128 XOF context. More... | |
void | parallelhash128_xof_absorb (parallelhash_t *hash, const uint8_t *src, const size_t len) |
Absorb data into a ParallelHash128 XOF context. More... | |
void | parallelhash128_xof_squeeze (parallelhash_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from a ParallelHash128 XOF context. More... | |
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. More... | |
void | parallelhash256_xof_init (parallelhash_t *xof, const parallelhash_params_t params) |
Initialize a ParallelHash256 XOF context. More... | |
void | parallelhash256_xof_absorb (parallelhash_t *xof, const uint8_t *src, const size_t len) |
Absorb data into a ParallelHash256 XOF context. More... | |
void | parallelhash256_xof_squeeze (parallelhash_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from a ParallelHash256 XOF context. More... | |
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. More... | |
Hash function and XOF, as defined in section 6 of SP 800-185.
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.
Initialize internal ParallelHash128 (NIST SP 800-185, section 6) context with configuration parameters params
, then squeeze dst_len
bytes of output from internal context into destination buffer dst
.
[in] | params | ParallelHash configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
void parallelhash128_xof_absorb | ( | parallelhash_t * | hash, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into a ParallelHash128 XOF context.
Absorb data in buffer src
of length len
bytes into ParallelHash128 XOF context. Can be called iteratively to absorb input data in chunks.
[in,out] | hash | ParallelHash128 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void parallelhash128_xof_init | ( | parallelhash_t * | xof, |
const parallelhash_params_t | params | ||
) |
Initialize a ParallelHash128 XOF context.
Initialize ParallelHash128 XOF (ParallelHash eXtendable Output Function, as defined in section 6.3.1 of NIST SP 800-185) context with configuration parameters params
.
[out] | xof | ParallelHash128 XOF context. |
[in] | params | ParallelHash configuration parameters. |
Example:
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.
Initialize internal ParallelHash128 XOF (ParallelHash eXtendable Output Function, as defined in section 6.3.1 of NIST SP 800-185) context with configuration parameters params
, absorb data in buffer src
of length src_len
bytes into context, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | params | ParallelHash configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
void parallelhash128_xof_squeeze | ( | parallelhash_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from a ParallelHash128 XOF context.
Squeeze len
bytes of output into destination buffer dst
from ParallelHash128 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | ParallelHash128 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example:
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.
Initialize internal ParallelHash256 (NIST SP 800-185, section 6) context with configuration parameters params
, then squeeze dst_len
bytes of output from internal context into destination buffer dst
.
[in] | params | ParallelHash configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
void parallelhash256_xof_absorb | ( | parallelhash_t * | xof, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into a ParallelHash256 XOF context.
Absorb data in buffer src
of length len
bytes into ParallelHash256 XOF context. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | ParallelHash256 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void parallelhash256_xof_init | ( | parallelhash_t * | xof, |
const parallelhash_params_t | params | ||
) |
Initialize a ParallelHash256 XOF context.
Initialize ParallelHash256 XOF (ParallelHash eXtendable Output Function, as defined in section 6.3.1 of NIST SP 800-185) context with configuration parameters params
.
Note: This ParallelHash implementation is sequential, not parallel.
[out] | xof | ParallelHash256 XOF context. |
[in] | params | ParallelHash configuration parameters. |
Example:
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.
Initialize internal ParallelHash256 XOF (ParallelHash eXtendable Output Function, as defined in section 6.3.1 of NIST SP 800-185) context with configuration parameters params
, absorb src_len
bytes if input from source buffer src
, then squeeze dst_len
bytes of output into destination buffer dst
.
Note: This ParallelHash implementation is sequential, not parallel.
[in] | params | ParallelHash configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
void parallelhash256_xof_squeeze | ( | parallelhash_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from a ParallelHash256 XOF context.
Squeeze len
bytes of output into destination buffer dst
from ParallelHash256 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
Note: This ParallelHash implementation is sequential, not parallel.
[in,out] | xof | ParallelHash256 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example: