ASCON Suite
Public Member Functions | Static Public Member Functions | List of all members
ascon::hash Class Reference

ASCON-HASH digest algorithm. More...

#include <hash.h>

Public Member Functions

 hash ()
 Constructs a new ASCON-HASH object. More...
 
 hash (const ascon::hash &other)
 Constructs a copy of another ASCON-HASH object. More...
 
 ~hash ()
 Destroys this ASCON-HASH object. More...
 
hashoperator= (const ascon::hash &other)
 Copies the state of another ASCON-HASH object into this one. More...
 
void reset ()
 Resets this ASCON-HASH object back to its initial state. More...
 
void update (const unsigned char *data, size_t len)
 Updates this ASCON-HASH object with new input data. More...
 
void update (const char *str)
 Updates this ASCON-HASH object with the contents of a NUL-terminated C string. More...
 
void update (const ascon::byte_array &data)
 Updates this ASCON-HASH object with the contents of a byte array. More...
 
void finalize (unsigned char digest[ASCON_HASH_SIZE])
 Finalizes this ASCON-HASH object and returns the digest. More...
 
ascon::byte_array finalize ()
 Finalizes this ASCON-HASH object and returns the digest as a byte array. More...
 
inline ::ascon_hash_state_tstate ()
 Gets a reference to the C version of the ASCON-HASH state. More...
 
const ::ascon_hash_state_tstate () const
 Gets a constant reference to the C version of the ASCON-HASH state. More...
 
void update (const std::string &str)
 Updates this ASCON-HASH object with the contents of a standard C++ string. More...
 

Static Public Member Functions

static void digest (unsigned char result[ASCON_HASH_SIZE], const unsigned char *data, size_t len)
 Computes the ASCON-HASH digest of a block of input data. More...
 

Detailed Description

ASCON-HASH digest algorithm.

Definition at line 216 of file hash.h.

Constructor & Destructor Documentation

◆ hash() [1/2]

ascon::hash::hash ( )
inline

Constructs a new ASCON-HASH object.

Definition at line 222 of file hash.h.

◆ hash() [2/2]

ascon::hash::hash ( const ascon::hash other)
inline

Constructs a copy of another ASCON-HASH object.

Parameters
otherThe other ASCON-HASH digest object.

Definition at line 232 of file hash.h.

◆ ~hash()

ascon::hash::~hash ( )
inline

Destroys this ASCON-HASH object.

Definition at line 240 of file hash.h.

Member Function Documentation

◆ digest()

static void ascon::hash::digest ( unsigned char  result[ASCON_HASH_SIZE],
const unsigned char *  data,
size_t  len 
)
inlinestatic

Computes the ASCON-HASH digest of a block of input data.

Parameters
resultPoints to the buffer to receive the digest.
dataPoints to the input data to be hashed.
lenLength of the input data to be hashed.

Definition at line 338 of file hash.h.

◆ finalize() [1/2]

ascon::byte_array ascon::hash::finalize ( )
inline

Finalizes this ASCON-HASH object and returns the digest as a byte array.

Returns
A byte array containing the finalized digest.

Definition at line 324 of file hash.h.

◆ finalize() [2/2]

void ascon::hash::finalize ( unsigned char  digest[ASCON_HASH_SIZE])
inline

Finalizes this ASCON-HASH object and returns the digest.

The application must call reset() to perform another hashing process.

Definition at line 313 of file hash.h.

◆ operator=()

hash& ascon::hash::operator= ( const ascon::hash other)
inline

Copies the state of another ASCON-HASH object into this one.

Parameters
otherThe other object to copy.
Returns
A reference to this ASCON-HASH object.

Definition at line 252 of file hash.h.

◆ reset()

void ascon::hash::reset ( )
inline

Resets this ASCON-HASH object back to its initial state.

Definition at line 264 of file hash.h.

◆ state() [1/2]

inline ::ascon_hash_state_t* ascon::hash::state ( )
inline

Gets a reference to the C version of the ASCON-HASH state.

Returns
A reference to the state.

Definition at line 350 of file hash.h.

◆ state() [2/2]

const ::ascon_hash_state_t* ascon::hash::state ( ) const
inline

Gets a constant reference to the C version of the ASCON-HASH state.

Returns
A constant reference to the state.

Definition at line 358 of file hash.h.

◆ update() [1/4]

void ascon::hash::update ( const ascon::byte_array data)
inline

Updates this ASCON-HASH object with the contents of a byte array.

Parameters
dataReference to the byte array to absorb.

Definition at line 303 of file hash.h.

◆ update() [2/4]

void ascon::hash::update ( const char *  str)
inline

Updates this ASCON-HASH object with the contents of a NUL-terminated C string.

Parameters
strPoints to the C string to absorb.

If str is NULL, then this function is equivalent to absorbing the empty string into the state.

Definition at line 289 of file hash.h.

◆ update() [3/4]

void ascon::hash::update ( const std::string &  str)
inline

Updates this ASCON-HASH object with the contents of a standard C++ string.

Parameters
strReference to the string to absorb.

Definition at line 368 of file hash.h.

◆ update() [4/4]

void ascon::hash::update ( const unsigned char *  data,
size_t  len 
)
inline

Updates this ASCON-HASH object with new input data.

Parameters
dataPoints to the input data to be absorbed into the state.
lenLength of the input data to be absorbed into the state.

Definition at line 275 of file hash.h.


The documentation for this class was generated from the following file: