Botan 3.3.0
Crypto and TLS for C&
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
14namespace Botan {
15
16/**
17* 24-bit cyclic redundancy check
18*
19* This is the CRC used for checksums in PGP
20*/
21class CRC24 final : public HashFunction {
22 public:
23 std::string name() const override { return "CRC24"; }
24
25 size_t output_length() const override { return 3; }
26
27 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 void clear() override { m_crc = 0XCE04B7L; }
32
33 CRC24() { clear(); }
34
35 ~CRC24() override { clear(); }
36
37 private:
38 void add_data(std::span<const uint8_t>) override;
39 void final_result(std::span<uint8_t>) override;
40 uint32_t m_crc;
41};
42
43} // namespace Botan
44
45#endif
std::unique_ptr< HashFunction > new_object() const override
Definition crc24.h:27
void clear() override
Definition crc24.h:31
~CRC24() override
Definition crc24.h:35
std::string name() const override
Definition crc24.h:23
std::unique_ptr< HashFunction > copy_state() const override
Definition crc24.cpp:154
size_t output_length() const override
Definition crc24.h:25
int(* final)(unsigned char *, CTX *)