Botan  2.4.0
Crypto and TLS for C++11
crc24.h
Go to the documentation of this file.
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 namespace Botan {
15 
16 /**
17 * 24-bit cyclic redundancy check
18 */
19 class BOTAN_PUBLIC_API(2,0) CRC24 final : public HashFunction
20  {
21  public:
22  std::string name() const override { return "CRC24"; }
23  size_t output_length() const override { return 3; }
24  HashFunction* clone() const override { return new CRC24; }
25  std::unique_ptr<HashFunction> copy_state() const override;
26 
27  void clear() override { m_crc = 0XCE04B7L; }
28 
29  CRC24() { clear(); }
30  ~CRC24() { clear(); }
31  private:
32  void add_data(const uint8_t[], size_t) override;
33  void final_result(uint8_t[]) override;
34  uint32_t m_crc;
35  };
36 
37 }
38 
39 #endif
std::string name() const override
Definition: crc24.h:22
size_t output_length() const override
Definition: crc24.h:23
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
~CRC24()
Definition: crc24.h:30
void clear() override
Definition: crc24.h:27
HashFunction * clone() const override
Definition: crc24.h:24
Definition: alg_id.cpp:13