43 #define ASCON_HASH_SIZE 32
49 #define ASCON_HASHA_SIZE ASCON_HASH_SIZE
55 #define ASCON_XOF_RATE 8
92 void ascon_xof(
unsigned char *out,
const unsigned char *in,
size_t inlen);
142 const unsigned char *custom,
size_t customlen,
size_t outlen);
185 const unsigned char *custom,
size_t customlen,
size_t outlen);
255 void ascon_xofa(
unsigned char *out,
const unsigned char *in,
size_t inlen);
305 const unsigned char *custom,
size_t customlen,
size_t outlen);
348 const unsigned char *custom,
size_t customlen,
size_t outlen);
439 template<
size_t outlen>
479 (
const char *function_name,
const unsigned char *custom = 0,
480 size_t customlen = 0)
483 (&m_state, function_name, custom, customlen, outlen);
498 (&m_state, function_name, custom.data(), custom.size(), outlen);
520 if (
this != &other) {
562 (&m_state,
reinterpret_cast<const unsigned char *
>(str),
622 inline ::ascon_xof_state_t *
state() {
return &m_state; }
629 inline const ::ascon_xof_state_t *
state()
const {
return &m_state; }
631 #if !defined(ARDUINO) && !defined(ASCON_NO_STL)
639 inline void absorb(
const std::string& str)
642 (&m_state,
reinterpret_cast<const unsigned char *
>(str.data()),
646 #elif defined(ARDUINO)
654 inline void absorb(
const String& str)
657 (&m_state,
reinterpret_cast<const unsigned char *
>(str.c_str()),
693 template<
size_t outlen>
733 (
const char *function_name,
const unsigned char *custom = 0,
734 size_t customlen = 0)
737 (&m_state, function_name, custom, customlen, outlen);
752 (&m_state, function_name, custom.data(), custom.size(), outlen);
774 if (
this != &other) {
873 inline ::ascon_xofa_state_t *
state() {
return &m_state; }
880 inline const ::ascon_xofa_state_t *
state()
const {
return &m_state; }
882 #if !defined(ARDUINO) && !defined(ASCON_NO_STL)
890 inline void absorb(
const std::string& str)
895 #elif defined(ARDUINO)
903 inline void absorb(
const String& str)
ASCON-XOF with a specific output length.
void squeeze(unsigned char *data, size_t len)
Squeezes output data from this ASCON-XOF object.
void absorb(const std::string &str)
Absorbs the contents of a standard C++ string into this ASCON-XOF object.
const ::ascon_xof_state_t * state() const
Gets a constant reference to the C version of the ASCON-XOF state.
xof_with_output_length(const char *function_name, const unsigned char *custom=0, size_t customlen=0)
Constructs a new ASCON-XOF object with a named function and customization string.
void reset()
Resets this ASCON-XOF object back to the initial state.
void absorb(const ascon::byte_array &data)
Absorbs the contents of a byte array into this ASCON-XOF object.
inline ::ascon_xof_state_t * state()
Gets a reference to the C version of the ASCON-XOF state.
~xof_with_output_length()
Destroys this ASCON-XOF object.
xof_with_output_length()
Constucts a new ASCON-XOF object.
void pad()
Absorbs enough zeroes into this ASCON-XOF object to pad the input to the next multiple of the block r...
void absorb(const unsigned char *data, size_t len)
Absorbs more input data into this ASCON-XOF object.
xof_with_output_length(const char *function_name, const ascon::byte_array &custom)
Constructs a new ASCON-XOF object with a named function and customization string.
xof_with_output_length(const ascon::xof_with_output_length< outlen > &other)
Constructs a copy of another ASCON-XOF object.
void absorb(const char *str)
Absorbs the contents of a NUL-terminated C string into this ASCON-XOF object.
ascon::byte_array squeeze(size_t len)
Squeezes data out of this ASCON-XOF object as a byte array.
ASCON-XOFA with a specific output length.
void absorb(const ascon::byte_array &data)
Absorbs the contents of a byte array into this ASCON-XOFA object.
xofa_with_output_length()
Constucts a new ASCON-XOFA object.
void absorb(const std::string &str)
Absorbs the contents of a standard C++ string into this ASCON-XOFA object.
void pad()
Absorbs enough zeroes into this ASCON-XOFA object to pad the input to the next multiple of the block ...
void absorb(const char *str)
Absorbs the contents of a NUL-terminated C string into this ASCON-XOFA object.
inline ::ascon_xofa_state_t * state()
Gets a reference to the C version of the ASCON-XOFA state.
xofa_with_output_length(const ascon::xofa_with_output_length< outlen > &other)
Constructs a copy of another ASCON-XOFA object.
void absorb(const unsigned char *data, size_t len)
Absorbs more input data into this ASCON-XOFA object.
void reset()
Resets this ASCON-XOFA object back to the initial state.
void squeeze(unsigned char *data, size_t len)
Squeezes output data from this ASCON-XOFA object.
xofa_with_output_length(const char *function_name, const unsigned char *custom=0, size_t customlen=0)
Constructs a new ASCON-XOFA object with a named function and customization string.
const ::ascon_xofa_state_t * state() const
Gets a constant reference to the C version of the ASCON-XOFA state.
~xofa_with_output_length()
Destroys this ASCON-XOFA object.
xofa_with_output_length(const char *function_name, const ascon::byte_array &custom)
Constructs a new ASCON-XOFA object with a named function and customization string.
ascon::byte_array squeeze(size_t len)
Squeezes data out of this ASCON-XOFA object as a byte array.
std::vector< unsigned char > byte_array
C++ type for an array of bytes.
xof_with_output_length< 0 > xof
ASCON-XOF object with arbitrary-length output.
xofa_with_output_length< 0 > xofa
ASCON-XOFA object with arbitrary-length output.
Direct access to the ASCON permutation primitive.
ascon_state_t state
[snippet_key]
unsigned char data[8]
[snippet_key]
State information for ASCON-XOF incremental mode.
State information for ASCON-XOFA incremental mode.
Structure of the internal state of the ASCON permutation.
System utilities of use to applications that use ASCON.
void ascon_xof_free(ascon_xof_state_t *state)
Frees the ASCON-XOF state and destroys any sensitive material.
void ascon_xof_pad(ascon_xof_state_t *state)
Absorbs enough zeroes into an ASCON-XOF state to pad the input to the next multiple of the block rate...
void ascon_xofa_squeeze(ascon_xofa_state_t *state, unsigned char *out, size_t outlen)
Squeezes output data from an ASCON-XOFA state.
void ascon_xof_reinit(ascon_xof_state_t *state)
Re-initializes the state for an ASCON-XOF hashing operation.
void ascon_xofa_reinit(ascon_xofa_state_t *state)
Re-initializes the state for an ASCON-XOFA hashing operation.
void ascon_xofa_reinit_fixed(ascon_xofa_state_t *state, size_t outlen)
Re-initializes the state for an incremental ASCON-XOFA operation, with a fixed output length.
void ascon_xofa(unsigned char *out, const unsigned char *in, size_t inlen)
Hashes a block of input data with ASCON-XOFA and generates a fixed-length 32 byte output.
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.
void ascon_xofa_reinit_custom(ascon_xofa_state_t *state, const char *function_name, const unsigned char *custom, size_t customlen, size_t outlen)
Re-nitializes the state for an incremental ASCON-XOFA operation, with a named function,...
void ascon_xof_init(ascon_xof_state_t *state)
Initializes the state for an ASCON-XOF hashing operation.
void ascon_xofa_absorb(ascon_xofa_state_t *state, const unsigned char *in, size_t inlen)
Absorbs more input data into an ASCON-XOFA state.
void ascon_xofa_init_custom(ascon_xofa_state_t *state, const char *function_name, const unsigned char *custom, size_t customlen, size_t outlen)
Initializes the state for an incremental ASCON-XOFA operation, with a named function,...
void ascon_xofa_init_fixed(ascon_xofa_state_t *state, size_t outlen)
Initializes the state for an incremental ASCON-XOFA operation, with a fixed output length.
void ascon_xof_init_custom(ascon_xof_state_t *state, const char *function_name, const unsigned char *custom, size_t customlen, size_t outlen)
Initializes the state for an incremental ASCON-XOF operation, with a named function,...
void ascon_xof_reinit_fixed(ascon_xof_state_t *state, size_t outlen)
Re-initializes the state for an incremental ASCON-XOF operation, with a fixed output length.
void ascon_xof_reinit_custom(ascon_xof_state_t *state, const char *function_name, const unsigned char *custom, size_t customlen, size_t outlen)
Re-nitializes the state for an incremental ASCON-XOF operation, with a named function,...
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.
void ascon_xofa_pad(ascon_xofa_state_t *state)
Absorbs enough zeroes into an ASCON-XOFA state to pad the input to the next multiple of the block rat...
void ascon_xofa_init(ascon_xofa_state_t *state)
Initializes the state for an ASCON-XOFA hashing operation.
void ascon_xof(unsigned char *out, const unsigned char *in, size_t inlen)
Hashes a block of input data with ASCON-XOF and generates a fixed-length 32 byte output.
void ascon_xofa_copy(ascon_xofa_state_t *dest, const ascon_xofa_state_t *src)
Clones a copy of an ASCON-XOFA state.
void ascon_xofa_free(ascon_xofa_state_t *state)
Frees the ASCON-XOFA state and destroys any sensitive material.
void ascon_xof_init_fixed(ascon_xof_state_t *state, size_t outlen)
Initializes the state for an incremental ASCON-XOF operation, with a fixed output length.