Crypto++
|
00001 #ifndef CRYPTOPP_ADLER32_H 00002 #define CRYPTOPP_ADLER32_H 00003 00004 #include "cryptlib.h" 00005 00006 NAMESPACE_BEGIN(CryptoPP) 00007 00008 //! ADLER-32 checksum calculations 00009 class Adler32 : public HashTransformation 00010 { 00011 public: 00012 CRYPTOPP_CONSTANT(DIGESTSIZE = 4) 00013 Adler32() {Reset();} 00014 void Update(const byte *input, size_t length); 00015 void TruncatedFinal(byte *hash, size_t size); 00016 unsigned int DigestSize() const {return DIGESTSIZE;} 00017 static const char * StaticAlgorithmName() {return "Adler32";} 00018 std::string AlgorithmName() const {return StaticAlgorithmName();} 00019 00020 private: 00021 void Reset() {m_s1 = 1; m_s2 = 0;} 00022 00023 word16 m_s1, m_s2; 00024 }; 00025 00026 NAMESPACE_END 00027 00028 #endif