Botan
1.11.15
|
00001 /* 00002 * CRC32 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_CRC32_H__ 00009 #define BOTAN_CRC32_H__ 00010 00011 #include <botan/hash.h> 00012 00013 namespace Botan { 00014 00015 /** 00016 * 32-bit cyclic redundancy check 00017 */ 00018 class BOTAN_DLL CRC32 : public HashFunction 00019 { 00020 public: 00021 std::string name() const { return "CRC32"; } 00022 size_t output_length() const { return 4; } 00023 HashFunction* clone() const { return new CRC32; } 00024 00025 void clear() { crc = 0xFFFFFFFF; } 00026 00027 CRC32() { clear(); } 00028 ~CRC32() { clear(); } 00029 private: 00030 void add_data(const byte[], size_t); 00031 void final_result(byte[]); 00032 u32bit crc; 00033 }; 00034 00035 } 00036 00037 #endif