1 /* 2 * CRC24 3 * (C) 1999-2007 Jack Lloyd 4 * (C) 2017 [Ribose Inc](https://www.ribose.com). Performed by Krzysztof Kwiatkowski. 5 * 6 * Botan is released under the Simplified BSD License (see license.txt) 7 */ 8 9 #ifndef BOTAN_CRC24_H_ 10 #define BOTAN_CRC24_H_ 11 12 #include <botan/hash.h> 13 14 BOTAN_FUTURE_INTERNAL_HEADER(crc24.h) 15 16 namespace Botan { 17 18 /** 19 * 24-bit cyclic redundancy check 20 */ 21 class BOTAN_PUBLIC_API(2,0) CRC24 final : public HashFunction 22 { 23 public: name()24 std::string name() const override { return "CRC24"; } output_length()25 size_t output_length() const override { return 3; } clone()26 HashFunction* clone() const override { return new CRC24; } 27 std::unique_ptr<HashFunction> copy_state() const override; 28 clear()29 void clear() override { m_crc = 0XCE04B7L; } 30 CRC24()31 CRC24() { clear(); } ~CRC24()32 ~CRC24() { clear(); } 33 private: 34 void add_data(const uint8_t[], size_t) override; 35 void final_result(uint8_t[]) override; 36 uint32_t m_crc; 37 }; 38 39 } 40 41 #endif 42