6#ifndef CRYPTOPP_CRC32_H
7#define CRYPTOPP_CRC32_H
11NAMESPACE_BEGIN(CryptoPP)
13const word32 CRC32_NEGL = 0xffffffffL;
15#if (CRYPTOPP_LITTLE_ENDIAN)
16#define CRC32_INDEX(c) (c & 0xff)
17#define CRC32_SHIFTED(c) (c >> 8)
19#define CRC32_INDEX(c) (c >> 24)
20#define CRC32_SHIFTED(c) (c << 8)
28 CRYPTOPP_CONSTANT(DIGESTSIZE = 4);
30 void Update(
const byte *input,
size_t length);
33 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "CRC32";}
38 void UpdateByte(
byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
43 byte GetCrcByte(
size_t i)
const {
return reinterpret_cast<const byte *
>(&m_crc)[i];}
48 void Reset() {m_crc = CRC32_NEGL;}
51 static const word32 m_tab[256];
61 CRYPTOPP_CONSTANT(DIGESTSIZE = 4);
63 void Update(
const byte *input,
size_t length);
66 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "CRC32C";}
71 void UpdateByte(
byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
76 byte GetCrcByte(
size_t i)
const {
return reinterpret_cast<const byte *
>(&m_crc)[i];}
81 void Reset() {m_crc = CRC32_NEGL;}
84 static const word32 m_tab[256];
CRC-32C Checksum Calculation.
void TruncatedFinal(byte *hash, size_t size)
Computes the hash of the current message.
std::string AlgorithmName() const
Provides the name of this algorithm.
void UpdateByte(byte b)
Updates a CRC with additional input.
byte GetCrcByte(size_t i) const
Retrieves the i-th byte of the CRC.
unsigned int DigestSize() const
void Update(const byte *input, size_t length)
Updates a hash with additional input.
std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
CRC-32 Checksum Calculation.
unsigned int DigestSize() const
byte GetCrcByte(size_t i) const
Retrieves the i-th byte of the CRC.
std::string AlgorithmName() const
Provides the name of this algorithm.
void TruncatedFinal(byte *hash, size_t size)
Computes the hash of the current message.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
void UpdateByte(byte b)
Updates a CRC with additional input.
unsigned int word32
32-bit unsigned datatype
Abstract base classes that provide a uniform interface to this library.