/src/botan/build/include/botan/internal/crc24.h
Line | Count | Source (jump to first uncovered line) |
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 CRC24 final : public HashFunction |
20 | | { |
21 | | public: |
22 | 0 | std::string name() const override { return "CRC24"; } |
23 | 0 | size_t output_length() const override { return 3; } |
24 | 0 | std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<CRC24>(); } |
25 | | std::unique_ptr<HashFunction> copy_state() const override; |
26 | | |
27 | 0 | void clear() override { m_crc = 0XCE04B7L; } |
28 | | |
29 | 0 | CRC24() { clear(); } |
30 | 0 | ~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 |