libxcks  0.1.0.1
libxcks::ChecksumEx Class Referenceabstract

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

#include <checksumex.hpp>

Inheritance diagram for libxcks::ChecksumEx:
Collaboration diagram for libxcks::ChecksumEx:

Public Member Functions

virtual void reset ()=0
 Resets the checksum to initial value. More...
 
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 uint8_t * getValue (uint8_t *buffer) const =0
 Returns the checksum value in the first bytes of the given address. More...
 
virtual size_t getSize () const =0
 Returns the minimal size to allocate in memory to store the checksum with the getValue(buffer) method. More...
 
virtual void update (const uint8_t *buf, size_t len)=0
 Updates the checksum with specified array of bytes. More...
 
virtual std::string getName () const =0
 Returns the name of the checksum or the hash algorithm. More...
 
virtual ArrayString getAltNames () const
 Returns the alternative name(s) of the checksum or the hash algorithm. More...
 
virtual ChecksumAlgoId getID () const =0
 Returns an unique identifier for the checksum or the hash algorithm. More...
 

Static Protected Member Functions

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...
 

Additional Inherited Members

- Static Public Member Functions inherited from libxcks::Checksum
static ArrayString getAlternativeNames ()
 Returns the alternative name(s) of the checksum or the hash algorithm. More...
 

Detailed Description

Computes a hash from a byte stream.

Adds some utilities to the Checksum class.

Definition at line 71 of file checksumex.hpp.

Member Function Documentation

◆ reset()

◆ swapOnBE() [1/2]

static uint32_t libxcks::ChecksumEx::swapOnBE ( const uint32_t  value)
inlinestaticprotected

Swaps bytes on big endian architectures.

Parameters
valueThe value to swap bytes.
Returns
Swapped bytes of value on big endian architectures.

Definition at line 120 of file checksumex.hpp.

◆ swapOnBE() [2/2]

static uint64_t libxcks::ChecksumEx::swapOnBE ( const uint64_t  value)
inlinestaticprotected

Swaps bytes on big endian architectures.

Parameters
valueThe value to swap bytes.
Returns
Swapped bytes of value on big endian architectures.

Definition at line 174 of file checksumex.hpp.

◆ swapOnLE() [1/2]

static uint32_t libxcks::ChecksumEx::swapOnLE ( const uint32_t  value)
inlinestaticprotected

Swaps bytes on little endian architectures.

Parameters
valueThe value to swap bytes.
Returns
Swapped bytes of value on little endian architectures.

Definition at line 95 of file checksumex.hpp.

◆ swapOnLE() [2/2]

static uint64_t libxcks::ChecksumEx::swapOnLE ( const uint64_t  value)
inlinestaticprotected

Swaps bytes on little endian architectures.

Parameters
valueThe value to swap bytes.
Returns
Swapped bytes of value on little endian architectures.

Definition at line 145 of file checksumex.hpp.

◆ toString()

string libxcks::ChecksumEx::toString ( const bool  hexInUpperCase = false) const
overridevirtual

Returns the hash value has a string.

Parameters
hexInUpperCaseIf true the hexadecimal letters will be in uppercase.
Returns
The current hash value.

Implements libxcks::Checksum.

Reimplemented in libxcks::CRC64, and libxcks::CRC32.

Definition at line 42 of file checksumex.cpp.


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