libxcks  0.1.0.1
libxcks::BLAKE3 Class Referencefinal

Computes the BLAKE3 hash from a byte stream. More...

#include <blake3.hpp>

Inheritance diagram for libxcks::BLAKE3:
Collaboration diagram for libxcks::BLAKE3:

Public Member Functions

 BLAKE3 ()
 Default constructor. More...
 
void reset () override
 Resets the BLAKE3 hash to initial state of computation. More...
 
uint8_t * getValue (uint8_t *buffer) const override
 Returns the BLAKE3 hash value in the first 32 bytes of the given address. More...
 
size_t getSize () const override
 Returns the minimal size to allocate in memory to store the hash with the getValue(buffer) method. More...
 
void update (const uint8_t *buf, size_t len) override
 Updates the BLAKE3 hash with specified array of bytes. More...
 
std::string getName () const override
 Returns the name of the checksum or the hash algorithm. More...
 
ChecksumAlgoId getID () const override
 Returns an unique identifier for the checksum or the hash algorithm. More...
 
- Public Member Functions inherited from libxcks::ChecksumEx
std::string toString (const bool hexInUpperCase=false) const override
 Returns the hash value has a string. More...
 
- Public Member Functions inherited from libxcks::Checksum
virtual ~Checksum ()
 Destructor. More...
 
virtual ArrayString getAltNames () const
 Returns the alternative name(s) of the checksum or the hash algorithm. More...
 

Static Public Member Functions

static std::string getHashName ()
 Returns the name of the hash algorithm. More...
 
static constexpr ChecksumAlgoId getIdentifier ()
 Returns an unique identifier for the hash algorithm. More...
 
static ChecksumgetNewInstance ()
 Gets a new instance of this class. More...
 
- Static Public Member Functions inherited from libxcks::Checksum
static ArrayString getAlternativeNames ()
 Returns the alternative name(s) of the checksum or the hash algorithm. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from libxcks::ChecksumEx
static uint32_t swapOnLE (const uint32_t value)
 Swaps bytes on little endian architectures. More...
 
static uint32_t swapOnBE (const uint32_t value)
 Swaps bytes on big endian architectures. More...
 
static uint64_t swapOnLE (const uint64_t value)
 Swaps bytes on little endian architectures. More...
 
static uint64_t swapOnBE (const uint64_t value)
 Swaps bytes on big endian architectures. More...
 

Detailed Description

Computes the BLAKE3 hash from a byte stream.

This class is a rewrite in C++ of the BLAKE3 hash computing algorithm from the official C implementation. Please see the BLAKE3 project website for more informations.

Using this class in very simple:
Use the update method to provide to the class the bytes for computing the hash.

The BLAKE3 hash value can be gotten by two ways:

The BLAKE3 hash computing can be reseted by the reset method.

Definition at line 56 of file blake3.hpp.

Constructor & Destructor Documentation

◆ BLAKE3()

libxcks::BLAKE3::BLAKE3 ( )

Default constructor.

Member Function Documentation

◆ getHashName()

static std::string libxcks::BLAKE3::getHashName ( )
inlinestatic

Returns the name of the hash algorithm.

Returns
The name of the hash algorithm.

Definition at line 274 of file blake3.hpp.

◆ getID()

ChecksumAlgoId libxcks::BLAKE3::getID ( ) const
inlineoverridevirtual

Returns an unique identifier for the checksum or the hash algorithm.

Remarks
The unique ID should be the CRC32 checksum of the algorithm's name returned by getName() but it's only a convention.
Returns
An unique identifier for the checksum or the hash algorithm.

Implements libxcks::Checksum.

Definition at line 264 of file blake3.hpp.

◆ getIdentifier()

static constexpr ChecksumAlgoId libxcks::BLAKE3::getIdentifier ( )
inlinestaticconstexpr

Returns an unique identifier for the hash algorithm.

Remarks
The unique ID should be the CRC32 checksum of the algorithm's name returned by getHashName() but it's only a convention.
Returns
An unique identifier for the hash algorithm.

Definition at line 288 of file blake3.hpp.

◆ getName()

std::string libxcks::BLAKE3::getName ( ) const
inlineoverridevirtual

Returns the name of the checksum or the hash algorithm.

Returns
The name of the checksum or the hash algorithm.

Implements libxcks::Checksum.

Definition at line 250 of file blake3.hpp.

◆ getNewInstance()

static Checksum* libxcks::BLAKE3::getNewInstance ( )
inlinestatic

Gets a new instance of this class.

The caller is responsible of the deletion of the instance with the delete operator.

Returns
A new instance of this class.

Definition at line 301 of file blake3.hpp.

◆ getSize()

size_t libxcks::BLAKE3::getSize ( ) const
inlineoverridevirtual

Returns the minimal size to allocate in memory to store the hash with the getValue(buffer) method.

Returns
The minimal size to allocate in memory to store the hash with the getValue(buffer) method.

Implements libxcks::Checksum.

Definition at line 234 of file blake3.hpp.

◆ getValue()

uint8_t* libxcks::BLAKE3::getValue ( uint8_t *  buffer) const
overridevirtual

Returns the BLAKE3 hash value in the first 32 bytes of the given address.

Parameters
bufferThe buffer where the BLAKE3 hash value will be stored.
Returns
The address of the buffer.
Remarks
The memory for the 32 bytes must have been allocated before calling this method.

Implements libxcks::Checksum.

◆ reset()

void libxcks::BLAKE3::reset ( )
overridevirtual

Resets the BLAKE3 hash to initial state of computation.

Implements libxcks::ChecksumEx.

◆ update()

void libxcks::BLAKE3::update ( const uint8_t *  buf,
size_t  len 
)
overridevirtual

Updates the BLAKE3 hash with specified array of bytes.

Parameters
bufThe byte array to update the BLAKE3 hash with.
lenThe number of bytes to use for the update.

Implements libxcks::Checksum.


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