Crypto++  8.2
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 
11 NAMESPACE_BEGIN(CryptoPP)
12 
13 /// ADLER-32 checksum calculations
15 {
16 public:
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 
25 private:
26  void Reset() {m_s1 = 1; m_s2 = 0;}
27 
28  word16 m_s1, m_s2;
29 };
30 
31 NAMESPACE_END
32 
33 #endif
std::string AlgorithmName() const
Provides the name of this algorithm.
Definition: adler32.h:23
Abstract base classes that provide a uniform interface to this library.
ADLER-32 checksum calculations.
Definition: adler32.h:14
unsigned int DigestSize() const
Provides the digest size of the hash.
Definition: adler32.h:21
Interface for hash functions and data processing part of MACs.
Definition: cryptlib.h:1084
Crypto++ library namespace.