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 NAMESPACE_BEGIN(CryptoPP)11NAMESPACE_BEGIN(CryptoPP) 12 13 /// ADLER-32 checksum calculations 14 class Adler32 : public HashTransformation 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 34