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

ASCON-HASHA digest algorithm. More...

#include <hash.h>

Public Member Functions

 hasha ()
 Constructs a new ASCON-HASHA object. More...
 
 hasha (const ascon::hasha &other)
 Constructs a copy of another ASCON-HASHA object. More...
 
 ~hasha ()
 Destroys this ASCON-HASHA object. More...
 
hashaoperator= (const ascon::hasha &other)
 Copies the state of another ASCON-HASHA object into this one. More...
 
void reset ()
 Resets this ASCON-HASHA object back to its initial state. More...
 
void update (const unsigned char *data, size_t len)
 Updates this ASCON-HASHA object with new input data. More...
 
void update (const char *str)
 Updates this ASCON-HASHA object with the contents of a NUL-terminated C string. More...
 
void update (const ascon::byte_array &data)
 Updates this ASCON-HASHA object with the contents of a byte array. More...
 
void finalize (unsigned char digest[ASCON_HASHA_SIZE])
 Finalizes this ASCON-HASHA object and returns the digest. More...
 
ascon::byte_array finalize ()
 Finalizes this ASCON-HASHA object and returns the digest as a byte array. More...
 
inline ::ascon_hasha_state_tstate ()
 Gets a reference to the C version of the ASCON-HASHA state. More...
 
const ::ascon_hasha_state_tstate () const
 Gets a constant reference to the C version of the ASCON-HASHA state. More...
 
void update (const std::string &str)
 Updates this ASCON-HASHA 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-HASHA digest of a block of input data. More...
 

Detailed Description

ASCON-HASHA digest algorithm.

Definition at line 399 of file hash.h.

Constructor & Destructor Documentation

◆ hasha() [1/2]

ascon::hasha::hasha ( )
inline

Constructs a new ASCON-HASHA object.

Definition at line 405 of file hash.h.

◆ hasha() [2/2]

ascon::hasha::hasha ( const ascon::hasha other)
inline

Constructs a copy of another ASCON-HASHA object.

Parameters
otherThe other ASCON-HASHA digest object.

Definition at line 415 of file hash.h.

◆ ~hasha()

ascon::hasha::~hasha ( )
inline

Destroys this ASCON-HASHA object.

Definition at line 423 of file hash.h.

Member Function Documentation

◆ digest()

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

Computes the ASCON-HASHA 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 521 of file hash.h.

◆ finalize() [1/2]

ascon::byte_array ascon::hasha::finalize ( )
inline

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

Returns
A byte array containing the finalized digest.

Definition at line 507 of file hash.h.

◆ finalize() [2/2]

void ascon::hasha::finalize ( unsigned char  digest[ASCON_HASHA_SIZE])
inline

Finalizes this ASCON-HASHA object and returns the digest.

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

Definition at line 496 of file hash.h.

◆ operator=()

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

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

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

Definition at line 435 of file hash.h.

◆ reset()

void ascon::hasha::reset ( )
inline

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

Definition at line 447 of file hash.h.

◆ state() [1/2]

inline ::ascon_hasha_state_t* ascon::hasha::state ( )
inline

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

Returns
A reference to the state.

Definition at line 533 of file hash.h.

◆ state() [2/2]

const ::ascon_hasha_state_t* ascon::hasha::state ( ) const
inline

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

Returns
A constant reference to the state.

Definition at line 541 of file hash.h.

◆ update() [1/4]

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

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

Parameters
dataReference to the byte array to absorb.

Definition at line 486 of file hash.h.

◆ update() [2/4]

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

Updates this ASCON-HASHA 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 472 of file hash.h.

◆ update() [3/4]

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

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

Parameters
strReference to the string to absorb.

Definition at line 551 of file hash.h.

◆ update() [4/4]

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

Updates this ASCON-HASHA 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 458 of file hash.h.


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