Base Framework
Public Member Functions | Static Public Attributes | List of all members
CRC32 Class Reference

CRC-32. More...

#include <base/security/CRC32.h>

Inherits Object, and PushInterface.

Public Member Functions

 CRC32 () noexcept
 
MemorySize push (const uint8 *buffer, MemorySize size) noexcept
 
void pushEnd () noexcept
 
uint64 getTotalSize () const noexcept
 
uint32 getValue () const noexcept
 
void setValue (uint32 value) noexcept
 
- Public Member Functions inherited from PushInterface
virtual void flush ()
 
virtual bool pushBegin (uint64 totalSize)
 

Static Public Attributes

static const uint32 LOOKUP [256]
 

Detailed Description

CRC-32.

Implementation of the 32 bit Cyclic Redundancy Check (CRC-32) algorithm as described by ISO 3309 (also see RFC 1952).

Should only be used for compatibility with legacy systems.

See also
Adler32 MD5Sum SHA1
Version
1.0
Examples
testsuite/digest.cpp.

Constructor & Destructor Documentation

◆ CRC32()

CRC32::CRC32 ( )
noexcept

Initializes object with an initial checksum of 0.

Member Function Documentation

◆ getTotalSize()

uint64 CRC32::getTotalSize ( ) const
inlinenoexcept

Returns the total size of the original message.

◆ getValue()

uint32 CRC32::getValue ( ) const
inlinenoexcept

Returns the checksum.

Examples
testsuite/digest.cpp.

◆ push()

MemorySize CRC32::push ( const uint8 *  buffer,
MemorySize  size 
)
virtualnoexcept

Updates the checksum corresponding to the specified data. May be called multiple times.

Parameters
bufferThe buffer holding the data.
sizeThe number of octets in the buffer.

Implements PushInterface.

Examples
testsuite/digest.cpp.

◆ pushEnd()

void CRC32::pushEnd ( )
inlinevirtualnoexcept

Does nothing.

Reimplemented from PushInterface.

Examples
testsuite/digest.cpp.

◆ setValue()

void CRC32::setValue ( uint32  value)
inlinenoexcept

Sets the checksum.

Member Data Documentation

◆ LOOKUP

const uint32 CRC32::LOOKUP[256]
static

Lookup table of CRCs of all 8-bit messages.