ASCON Suite
Classes | Namespaces | Functions
hash.h File Reference

ASCON-HASH and ASCON-HASHA hash algorithms. More...

#include <ascon/xof.h>

Go to the source code of this file.

Classes

struct  ascon_hash_state_t
 State information for the ASCON-HASH incremental mode. More...
 
struct  ascon_hasha_state_t
 State information for the ASCON-HASHA incremental mode. More...
 
class  ascon::hash
 ASCON-HASH digest algorithm. More...
 
class  ascon::hasha
 ASCON-HASHA digest algorithm. More...
 

Namespaces

 ascon
 

Functions

void ascon_hash (unsigned char *out, const unsigned char *in, size_t inlen)
 Hashes a block of input data with ASCON-HASH. More...
 
void ascon_hash_init (ascon_hash_state_t *state)
 Initializes the state for an ASCON-HASH hashing operation. More...
 
void ascon_hash_reinit (ascon_hash_state_t *state)
 Re-initializes the state for an ASCON-HASH hashing operation. More...
 
void ascon_hash_free (ascon_hash_state_t *state)
 Frees the ASCON-HASH state and destroys any sensitive material. More...
 
void ascon_hash_update (ascon_hash_state_t *state, const unsigned char *in, size_t inlen)
 Updates an ASCON-HASH state with more input data. More...
 
void ascon_hash_finalize (ascon_hash_state_t *state, unsigned char *out)
 Returns the final hash value from an ASCON-HASH hashing operation. More...
 
void ascon_hash_copy (ascon_hash_state_t *dest, const ascon_hash_state_t *src)
 Clones a copy of an ASCON-HASH state. More...
 
void ascon_hasha (unsigned char *out, const unsigned char *in, size_t inlen)
 Hashes a block of input data with ASCON-HASHA. More...
 
void ascon_hasha_init (ascon_hasha_state_t *state)
 Initializes the state for an ASCON-HASHA hashing operation. More...
 
void ascon_hasha_reinit (ascon_hasha_state_t *state)
 Re-initializes the state for an ASCON-HASHA hashing operation. More...
 
void ascon_hasha_free (ascon_hasha_state_t *state)
 Frees the ASCON-HASHA state and destroys any sensitive material. More...
 
void ascon_hasha_update (ascon_hasha_state_t *state, const unsigned char *in, size_t inlen)
 Updates an ASCON-HASHA state with more input data. More...
 
void ascon_hasha_finalize (ascon_hasha_state_t *state, unsigned char *out)
 Returns the final hash value from an ASCON-HASHA hashing operation. More...
 
void ascon_hasha_copy (ascon_hasha_state_t *dest, const ascon_hasha_state_t *src)
 Clones a copy of an ASCON-HASHA state. More...
 

Detailed Description

ASCON-HASH and ASCON-HASHA hash algorithms.

References: https://ascon.iaik.tugraz.at/

Definition in file hash.h.

Function Documentation

◆ ascon_hash()

void ascon_hash ( unsigned char *  out,
const unsigned char *  in,
size_t  inlen 
)

Hashes a block of input data with ASCON-HASH.

Parameters
outBuffer to receive the hash output which must be at least ASCON_HASH_SIZE bytes in length.
inPoints to the input data to be hashed.
inlenLength of the input data in bytes.
See also
ascon_hash_init(), ascon_hash_absorb(), ascon_hash_squeeze()
Examples
permutation/encrypt/main.c.

Definition at line 27 of file ascon-hash.c.

◆ ascon_hash_copy()

void ascon_hash_copy ( ascon_hash_state_t dest,
const ascon_hash_state_t src 
)

Clones a copy of an ASCON-HASH state.

Parameters
destDestination hash state to copy into.
srcSource hash state to copy from.

The destination will be initialized by this operation, so it must not previously have been initialized or it has already been freed. The source must be already initialized.

Definition at line 100 of file ascon-hash.c.

◆ ascon_hash_finalize()

void ascon_hash_finalize ( ascon_hash_state_t state,
unsigned char *  out 
)

Returns the final hash value from an ASCON-HASH hashing operation.

Parameters
stateHash state to be finalized.
outPoints to the output buffer to receive the 32-byte hash value.
See also
ascon_hash_init(), ascon_hash_update()
Examples
asconsum/asconsum.c.

Definition at line 95 of file ascon-hash.c.

◆ ascon_hash_free()

void ascon_hash_free ( ascon_hash_state_t state)

Frees the ASCON-HASH state and destroys any sensitive material.

Parameters
stateHash state to be freed.
Examples
asconsum/asconsum.c.

Definition at line 84 of file ascon-hash.c.

◆ ascon_hash_init()

void ascon_hash_init ( ascon_hash_state_t state)

Initializes the state for an ASCON-HASH hashing operation.

Parameters
stateHash state to be initialized.
See also
ascon_hash_update(), ascon_hash_finalize(), ascon_hash()
Examples
asconsum/asconsum.c.

Definition at line 36 of file ascon-hash.c.

◆ ascon_hash_reinit()

void ascon_hash_reinit ( ascon_hash_state_t state)

Re-initializes the state for an ASCON-HASH hashing operation.

Parameters
stateHash state to be re-initialized.

This function is equivalent to calling ascon_hash_free() and then ascon_hash_init() to restart the hashing process.

See also
ascon_hash_init()

Definition at line 73 of file ascon-hash.c.

◆ ascon_hash_update()

void ascon_hash_update ( ascon_hash_state_t state,
const unsigned char *  in,
size_t  inlen 
)

Updates an ASCON-HASH state with more input data.

Parameters
stateHash state to be updated.
inPoints to the input data to be incorporated into the state.
inlenLength of the input data to be incorporated into the state.
See also
ascon_hash_init(), ascon_hash_finalize()
Examples
asconsum/asconsum.c.

Definition at line 89 of file ascon-hash.c.

◆ ascon_hasha()

void ascon_hasha ( unsigned char *  out,
const unsigned char *  in,
size_t  inlen 
)

Hashes a block of input data with ASCON-HASHA.

Parameters
outBuffer to receive the hash output which must be at least ASCON_HASHA_SIZE bytes in length.
inPoints to the input data to be hashed.
inlenLength of the input data in bytes.
See also
ascon_hasha_init(), ascon_hasha_absorb(), ascon_hasha_squeeze()
Examples
permutation/hash/main.c.

Definition at line 27 of file ascon-hasha.c.

◆ ascon_hasha_copy()

void ascon_hasha_copy ( ascon_hasha_state_t dest,
const ascon_hasha_state_t src 
)

Clones a copy of an ASCON-HASHA state.

Parameters
destDestination hash state to copy into.
srcSource hash state to copy from.

The destination will be initialized by this operation, so it must not previously have been initialized or it has already been freed. The source must be already initialized.

Definition at line 100 of file ascon-hasha.c.

◆ ascon_hasha_finalize()

void ascon_hasha_finalize ( ascon_hasha_state_t state,
unsigned char *  out 
)

Returns the final hash value from an ASCON-HASHA hashing operation.

Parameters
stateHash state to be finalized.
outPoints to the output buffer to receive the 32-byte hash value.
See also
ascon_hasha_init(), ascon_hasha_update()
Examples
asconsum/asconsum.c.

Definition at line 95 of file ascon-hasha.c.

◆ ascon_hasha_free()

void ascon_hasha_free ( ascon_hasha_state_t state)

Frees the ASCON-HASHA state and destroys any sensitive material.

Parameters
stateHash state to be freed.
Examples
asconsum/asconsum.c.

Definition at line 84 of file ascon-hasha.c.

◆ ascon_hasha_init()

void ascon_hasha_init ( ascon_hasha_state_t state)

Initializes the state for an ASCON-HASHA hashing operation.

Parameters
stateHash state to be initialized.
See also
ascon_hasha_update(), ascon_hasha_finalize(), ascon_hasha()
Examples
asconsum/asconsum.c.

Definition at line 36 of file ascon-hasha.c.

◆ ascon_hasha_reinit()

void ascon_hasha_reinit ( ascon_hasha_state_t state)

Re-initializes the state for an ASCON-HASHA hashing operation.

Parameters
stateHash state to be re-initialized.

This function is equivalent to calling ascon_hasha_free() and then ascon_hasha_init() to restart the hashing process.

See also
ascon_hasha_init()

Definition at line 73 of file ascon-hasha.c.

◆ ascon_hasha_update()

void ascon_hasha_update ( ascon_hasha_state_t state,
const unsigned char *  in,
size_t  inlen 
)

Updates an ASCON-HASHA state with more input data.

Parameters
stateHash state to be updated.
inPoints to the input data to be incorporated into the state.
inlenLength of the input data to be incorporated into the state.
See also
ascon_hasha_init(), ascon_hasha_finalize()
Examples
asconsum/asconsum.c.

Definition at line 89 of file ascon-hasha.c.