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