Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Macros | Functions
xoodyak-hash.h File Reference

Xoodyak-Hash hash algorithm. More...

#include <stddef.h>

Go to the source code of this file.

Data Structures

union  xoodyak_hash_state_t
 State information for Xoodyak incremental hashing modes. More...
 

Macros

#define XOODYAK_HASH_SIZE   32
 Size of the hash output for Xoodyak.
 
#define XOODYAK_HASH_RATE   16
 Rate for absorbing and squeezing in Xoodyak's hashing mode.
 

Functions

int xoodyak_hash (unsigned char *out, const unsigned char *in, size_t inlen)
 Hashes a block of input data with Xoodyak to generate a hash value. More...
 
void xoodyak_hash_init (xoodyak_hash_state_t *state)
 Initializes the state for a Xoodyak hashing operation. More...
 
void xoodyak_hash_absorb (xoodyak_hash_state_t *state, const unsigned char *in, size_t inlen)
 Aborbs more input data into a Xoodyak hashing state. More...
 
void xoodyak_hash_squeeze (xoodyak_hash_state_t *state, unsigned char *out, size_t outlen)
 Squeezes output data from a Xoodyak hashing state. More...
 
void xoodyak_hash_finalize (xoodyak_hash_state_t *state, unsigned char *out)
 Returns the final hash value from a Xoodyak hashing operation. More...
 
void xoodyak_hash_pad (xoodyak_hash_state_t *state)
 Absorbs enough zeroes into a Xoodyak hashing state to pad the input to the next multiple of the block rate. More...
 

Detailed Description

Xoodyak-Hash hash algorithm.

Xoodyak-Hash is based around the 384-bit Xoodoo permutation and has a 256-bit output. Xoodyak-Hash can also be used as an extensible output function (XOF).

References: https://keccak.team/xoodyak.html

Function Documentation

int xoodyak_hash ( unsigned char *  out,
const unsigned char *  in,
size_t  inlen 
)

Hashes a block of input data with Xoodyak to generate a hash value.

Parameters
outBuffer to receive the hash output which must be at least XOODYAK_HASH_SIZE bytes in length.
inPoints to the input data to be hashed.
inlenLength of the input data in bytes.
Returns
Returns zero on success or -1 if there was an error in the parameters.
void xoodyak_hash_absorb ( xoodyak_hash_state_t state,
const unsigned char *  in,
size_t  inlen 
)

Aborbs more input data into a Xoodyak hashing state.

Parameters
stateHash state to be updated.
inPoints to the input data to be absorbed into the state.
inlenLength of the input data to be absorbed into the state.
See Also
xoodyak_hash_init(), xoodyak_hash_squeeze()
void xoodyak_hash_finalize ( xoodyak_hash_state_t state,
unsigned char *  out 
)

Returns the final hash value from a Xoodyak hashing operation.

Parameters
stateHash state to be finalized.
outPoints to the output buffer to receive the hash value.
Note
This is a wrapper around xoodyak_hash_squeeze() for a fixed length of XOODYAK_HASH_SIZE bytes.
See Also
xoodyak_hash_init(), xoodyak_hash_absorb()
void xoodyak_hash_init ( xoodyak_hash_state_t state)

Initializes the state for a Xoodyak hashing operation.

Parameters
stateHash state to be initialized.
See Also
xoodyak_hash_absorb(), xoodyak_hash_squeeze(), xoodyak_hash()
void xoodyak_hash_pad ( xoodyak_hash_state_t state)

Absorbs enough zeroes into a Xoodyak hashing state to pad the input to the next multiple of the block rate.

Parameters
stateThe state to pad. Does nothing if the state is already aligned on a multiple of the block rate.

This function can avoid unnecessary XOR-with-zero operations to save some time when padding is required.

void xoodyak_hash_squeeze ( xoodyak_hash_state_t state,
unsigned char *  out,
size_t  outlen 
)

Squeezes output data from a Xoodyak hashing state.

Parameters
stateHash state to squeeze the output data from.
outPoints to the output buffer to receive the squeezed data.
outlenNumber of bytes of data to squeeze out of the state.
See Also
xoodyak_hash_init(), xoodyak_hash_absorb()