1 /* 2 * Adler32 3 * (C) 1999-2007 Jack Lloyd 4 * 5 * Distributed under the terms of the Botan license 6 */ 7 8 #ifndef BOTAN_ADLER32_H__ 9 #define BOTAN_ADLER32_H__ 10 11 #include <botan/hash.h> 12 13 namespace Botan { 14 15 /** 16 * The Adler32 checksum, used in zlib 17 */ 18 class BOTAN_DLL Adler32 : public HashFunction 19 { 20 public: name()21 std::string name() const { return "Adler32"; } output_length()22 size_t output_length() const { return 4; } clone()23 HashFunction* clone() const { return new Adler32; } 24 clear()25 void clear() { S1 = 1; S2 = 0; } 26 Adler32()27 Adler32() { clear(); } ~Adler32()28 ~Adler32() { clear(); } 29 private: 30 void add_data(const byte[], size_t); 31 void final_result(byte[]); 32 u16bit S1, S2; 33 }; 34 35 } 36 37 #endif 38