Crypto++ 8.8
Free C++ class library of cryptographic schemes
adler32.h
Go to the documentation of this file.
1// adler32.h - originally written and placed in the public domain by Wei Dai
2
3/// \file adler32.h
4/// \brief Class file for ADLER-32 checksum calculations
5
6#ifndef CRYPTOPP_ADLER32_H
7#define CRYPTOPP_ADLER32_H
8
9#include "cryptlib.h"
10
11NAMESPACE_BEGIN(CryptoPP)
12
13/// ADLER-32 checksum calculations
14class Adler32 : public HashTransformation
15{
16public:
17 CRYPTOPP_CONSTANT(DIGESTSIZE = 4);
18 Adler32() {Reset();}
19 void Update(const byte *input, size_t length);
20 void TruncatedFinal(byte *hash, size_t size);
21 unsigned int DigestSize() const {return DIGESTSIZE;}
22 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Adler32";}
23 std::string AlgorithmName() const {return StaticAlgorithmName();}
24
25private:
26 void Reset() {m_s1 = 1; m_s2 = 0;}
27
28 word16 m_s1, m_s2;
29};
30
31NAMESPACE_END
32
33#endif
unsigned int DigestSize() const
Provides the digest size of the hash.
Definition adler32.h:21
std::string AlgorithmName() const
Provides the name of this algorithm.
Definition adler32.h:23
void Update(const byte *input, size_t length)
Updates a hash with additional input.
Definition adler32.cpp:8
void TruncatedFinal(byte *hash, size_t size)
Computes the hash of the current message.
Definition adler32.cpp:56
Interface for hash functions and data processing part of MACs.
Definition cryptlib.h:1118
unsigned short word16
16-bit unsigned datatype
Definition config_int.h:69
Abstract base classes that provide a uniform interface to this library.
Crypto++ library namespace.