libxcks
0.1.0.1
|
Computes the CRC-32 from a byte stream. More...
#include <crc32.hpp>
Public Member Functions | |
CRC32 () | |
Default constructor. More... | |
void | reset () override |
Resets the CRC32 to initial value. More... | |
uint32_t | getUint32Value () const |
Returns the CRC32 value. More... | |
std::string | toString (const bool hexInUpperCase=false) const override |
Returns the CRC32 value in a string. More... | |
uint8_t * | getValue (uint8_t *buffer) const override |
Returns the CRC32 value in the first 4 bytes of the given address. More... | |
size_t | getSize () const override |
Returns the minimal size to allocate in memory to store the checksum with the getValue(buffer) method. More... | |
void | update (const uint8_t *buf, size_t len) override |
Updates the CRC32 with specified array of bytes. More... | |
std::string | getName () const override |
Returns the name of the checksum or the hash algorithm. More... | |
ArrayString | getAltNames () const override |
Returns the alternative names of the CRC32 checksum algorithm. More... | |
ChecksumAlgoId | getID () const override |
Returns an unique identifier for the checksum or the hash algorithm. More... | |
Public Member Functions inherited from libxcks::Checksum | |
virtual | ~Checksum () |
Destructor. More... | |
Static Public Member Functions | |
static std::string | getChecksumName () |
Returns the name of the checksum algorithm. More... | |
static constexpr ChecksumAlgoId | getIdentifier () |
Returns an unique identifier for the checksum algorithm. More... | |
static ArrayString | getAlternativeNames () |
Returns the alternative names of the CRC32 checksum algorithm. More... | |
static Checksum * | getNewInstance () |
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... | |
Protected Attributes | |
uint32_t | crc32 |
The current CRC32 value. More... | |
Static Protected Attributes | |
static const uint32_t | crc_table [256] |
Table used to compute the CRC32 value. 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... | |
Computes the CRC-32 from a byte stream.
This class is writen with the code found in cksfv and zlib code.
Using this class in very simple:
Use the update method to provide to the class the bytes for computing the checksum.
The CRC-32 checksum value can be gotten by the getUint32Value method which puts the CRC32 checksum value in an unsigned 32 bits integer.
The CRC32 checksum computing can be reseted by the reset method.
|
static |
|
inlineoverridevirtual |
Returns the alternative names of the CRC32 checksum algorithm.
Reimplemented from libxcks::Checksum.
|
inlinestatic |
|
inlineoverridevirtual |
Returns an unique identifier for the checksum or the hash algorithm.
Implements libxcks::Checksum.
|
inlinestaticconstexpr |
Returns an unique identifier for the checksum algorithm.
|
inlineoverridevirtual |
Returns the name of the checksum or the hash algorithm.
Implements libxcks::Checksum.
|
inlinestatic |
|
inlineoverridevirtual |
Returns the minimal size to allocate in memory to store the checksum with the getValue(buffer) method.
Implements libxcks::Checksum.
uint32_t libxcks::CRC32::getUint32Value | ( | ) | const |
|
overridevirtual |
Returns the CRC32 value in the first 4 bytes of the given address.
buffer | The buffer where the CRC32 value will be stored. |
Implements libxcks::Checksum.
|
overridevirtual |
Resets the CRC32 to initial value.
Implements libxcks::ChecksumEx.
|
overridevirtual |
Returns the CRC32 value in a string.
hexInUpperCase | If true the hexadecimal letters will be in uppercase. |
Reimplemented from libxcks::ChecksumEx.
|
overridevirtual |
Updates the CRC32 with specified array of bytes.
buf | The byte array to update the CRC32 with. |
len | The number of bytes to use for the update. |
Implements libxcks::Checksum.
|
protected |
|
staticprotected |