all repos — TinyCrypT @ b2074322e2415a2728d0b4b287f210a31929632f

Short and sweet classical cryptographic primitives

tinycrypt/kangarootwelve128.h (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
#ifndef TCT_KT128_H
#define TCT_KT128_H

#include <stdint.h>

/// Implements the KangarooTwelve128 hashing algorithm as defined in RFC 8961
void tct_kangarootwelve128 (const uint8_t *input, const uint64_t input_len,
                            const uint8_t *custom_str, const uint64_t cs_len,
                            uint8_t *output, const uint64_t output_len);

#define TCT_TURBOSHAKE128_STATE_LEN 200

/// Initialize TurboSHAKE128 state
void tct_turboshake128_init (uint8_t state[TCT_TURBOSHAKE128_STATE_LEN]);

/// Absorb new data into the TurboSHAKE128 state
void tct_turboshake128_absorb (uint8_t state[TCT_TURBOSHAKE128_STATE_LEN],
                               const uint8_t *data, const uint64_t data_len,
                               const uint8_t separation_byte);

/// Squeeze new hashed data out of the TurboSHAKE128 state, destructively (to
/// the state)
void tct_turboshake128_squeeze_destructive (
    uint8_t state[TCT_TURBOSHAKE128_STATE_LEN], uint8_t *output,
    const uint64_t output_len);

#endif