27 void ascon_hash(
unsigned char *out,
const unsigned char *in,
size_t inlen)
39 #if defined(ASCON_BACKEND_SLICED64)
40 static uint64_t
const iv[5] = {
41 0xee9398aadb67f03dULL, 0x8bb21831c60f1002ULL,
42 0xb48a92db98d5da62ULL, 0x43189921b8f8e3e8ULL,
45 memcpy(
state->xof.state.
S, iv,
sizeof(iv));
46 #elif defined(ASCON_BACKEND_SLICED32)
47 static uint32_t
const iv[10] = {
48 0xa540dbc7, 0xf9afb5c6, 0x1445a340, 0xbd249301,
49 0x604d4fc8, 0xcb9ba8b5, 0x94514c98, 0x12a4eede,
50 0x6339f398, 0x4bca84c0
52 memcpy(
state->xof.state.
W, iv,
sizeof(iv));
54 static uint8_t
const iv[40] = {
55 0xee, 0x93, 0x98, 0xaa, 0xdb, 0x67, 0xf0, 0x3d,
56 0x8b, 0xb2, 0x18, 0x31, 0xc6, 0x0f, 0x10, 0x02,
57 0xb4, 0x8a, 0x92, 0xdb, 0x98, 0xd5, 0xda, 0x62,
58 0x43, 0x18, 0x99, 0x21, 0xb8, 0xf8, 0xe3, 0xe8,
59 0x34, 0x8f, 0xa5, 0xc9, 0xd5, 0x25, 0xe1, 0x40
61 #if defined(ASCON_BACKEND_DIRECT_XOR)
62 memcpy(
state->xof.state.
B, iv,
sizeof(iv));
75 #if defined(ASCON_BACKEND_SLICED64) || defined(ASCON_BACKEND_SLICED32) || \
76 defined(ASCON_BACKEND_DIRECT_XOR)
void ascon_hash_init(ascon_hash_state_t *state)
Initializes the state for an ASCON-HASH hashing operation.
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.
void ascon_hash_finalize(ascon_hash_state_t *state, unsigned char *out)
Returns the final hash value from an ASCON-HASH hashing operation.
void ascon_hash(unsigned char *out, const unsigned char *in, size_t inlen)
Hashes a block of input data with ASCON-HASH.
void ascon_hash_free(ascon_hash_state_t *state)
Frees the ASCON-HASH state and destroys any sensitive material.
void ascon_hash_copy(ascon_hash_state_t *dest, const ascon_hash_state_t *src)
Clones a copy of an ASCON-HASH state.
void ascon_hash_reinit(ascon_hash_state_t *state)
Re-initializes the state for an ASCON-HASH hashing operation.
ASCON-HASH and ASCON-HASHA hash algorithms.
void ascon_release(ascon_state_t *state)
Temporarily releases access to any shared hardware resources that a permutation state was using.
void ascon_overwrite_bytes(ascon_state_t *state, const uint8_t *data, unsigned offset, unsigned size)
Overwrites existing bytes in the ASCON state.
void ascon_init(ascon_state_t *state)
Initializes the words of the ASCON permutation state to zero.
ascon_state_t state
[snippet_key]
State information for the ASCON-HASH incremental mode.
void ascon_xof_free(ascon_xof_state_t *state)
Frees the ASCON-XOF state and destroys any sensitive material.
void ascon_xof_absorb(ascon_xof_state_t *state, const unsigned char *in, size_t inlen)
Absorbs more input data into an ASCON-XOF state.
#define ASCON_HASH_SIZE
Size of the hash output for ASCON-HASH and the default hash output size for ASCON-XOF.
void ascon_xof_copy(ascon_xof_state_t *dest, const ascon_xof_state_t *src)
Clones a copy of an ASCON-XOF state.
void ascon_xof_squeeze(ascon_xof_state_t *state, unsigned char *out, size_t outlen)
Squeezes output data from an ASCON-XOF state.