Coverage Report

Created: 2023-06-07 07:00

/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
* This is the CRC used for checksums in PGP
20
*/
21
class CRC24 final : public HashFunction {
22
   public:
23
0
      std::string name() const override { return "CRC24"; }
24
25
0
      size_t output_length() const override { return 3; }
26
27
0
      std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<CRC24>(); }
28
29
      std::unique_ptr<HashFunction> copy_state() const override;
30
31
0
      void clear() override { m_crc = 0XCE04B7L; }
32
33
0
      CRC24() { clear(); }
34
35
0
      ~CRC24() { clear(); }
36
37
   private:
38
      void add_data(const uint8_t[], size_t) override;
39
      void final_result(uint8_t[]) override;
40
      uint32_t m_crc;
41
};
42
43
}  // namespace Botan
44
45
#endif