sha3.h¶
Header definitions for the SHA-3 hash function.
-
SHA3_256_DIGEST_LENGTH
¶ Length of SHA256 digests in bytes.
1
32
-
SHA3_384_DIGEST_LENGTH
¶ Length of SHA384 digests in bytes.
1
48
-
SHA3_512_DIGEST_LENGTH
¶ Length of SHA512 digests in bytes.
1
64
-
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.
Parameters
ctx: context handle to initialise rate: the desired rate of the sponge capacity: the desired capcity of the sponge 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
Parameters
ctx: context handle of the sponge input: pointer to the data to be absorbed inputByteLen: length of the input data in bytes
-
void
Keccak_final
(keccak_state_t * ctx, unsigned char * output, unsigned long long int outputByteLen)¶ Squeeze data from a sponge.
Parameters
ctx: context handle of the sponge output: the squeezed data outputByteLen: size of the data to be squeezed.
-
void
sha3_256_init
(keccak_state_t * ctx)¶ SHA-3-256 initialization.
Begins a SHA-3-256 operation.
Parameters
ctx: keccak_state_t handle to initialise
-
void
sha3_update
(keccak_state_t * ctx, const void * data,msp430_types.h::size_t
len)¶ Add bytes into the hash.
Parameters
ctx: context handle to use data: Input data len: Length of data
-
void
sha3_256_final
(keccak_state_t * ctx, void * digest)¶ SHA-3-256 finalization.
Pads the input data and exports the hash value
Parameters
ctx: context handle to use digest: resulting digest, this is the hash of all the bytes
-
void
sha3_384_init
(keccak_state_t * ctx)¶ SHA-3-384 initialization.
Begins a SHA-3-256 operation.
Parameters
ctx: keccak_state_t handle to initialise
-
void
sha3_384_final
(keccak_state_t * ctx, void * digest)¶ SHA-3-384 finalization.
Pads the input data and exports the hash value
Parameters
ctx: context handle to use digest: resulting digest, this is the hash of all the bytes
-
void
sha3_512_init
(keccak_state_t * ctx)¶ SHA-3-512 initialization.
Begins a SHA-3-256 operation.
Parameters
ctx: keccak_state_t handle to initialise
-
void
sha3_512_final
(keccak_state_t * ctx, void * digest)¶ SHA-3-512 finalization.
Pads the input data and exports the hash value
Parameters
ctx: context handle to use digest: resulting digest, this is the hash of all the bytes
-
void
sha3_256
(void * digest, const void * data,msp430_types.h::size_t
len)¶ A wrapper function to simplify the generation of a hash, this is usefull for generating SHA-3-256 from one buffer.
Parameters
data: pointer to the buffer to generate hash from len: length of the buffer digest: pointer to an array for the result, length must be SHA3_256_DIGEST_LENGTH
-
void
sha3_384
(void * digest, const void * data,msp430_types.h::size_t
len)¶ A wrapper function to simplify the generation of a hash, this is usefull for generating SHA-3-384 from one buffer.
Parameters
data: pointer to the buffer to generate hash from len: length of the buffer digest: pointer to an array for the result, length must be SHA3_384_DIGEST_LENGTH
-
void
sha3_512
(void * digest, const void * data,msp430_types.h::size_t
len)¶ A wrapper function to simplify the generation of a hash, this is usefull for generating SHA-3-512 from one buffer.
Parameters
data: pointer to the buffer to generate hash from len: length of the buffer digest: pointer to an array for the result, length must be SHA3_512_DIGEST_LENGTH
-
struct
keccak_state_t
¶ Context for operations on a sponge with keccak permutation.
-
unsigned char
state
()¶ State of the Keccak sponge.
-
unsigned int
i
¶ Current position within the state.
-
unsigned char
delimitedSuffix
¶ The suffix used for padding.
-
unsigned int
rate
¶ The bitrate of the sponge.
-
unsigned int
capacity
¶ The capacity in bits of the sponge.
-
unsigned int
rateInBytes
¶ The rate in bytes of the sponge.
-
unsigned char