Botan 3.13.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 size_t security_level() const override { return 0; }
28
29 std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<CRC24>(); }
30
31 std::unique_ptr<HashFunction> copy_state() const override;
32
33 void clear() override { m_crc = 0xCE04B7; }
34
35 private:
36 void add_data(std::span<const uint8_t> input) override;
37 void final_result(std::span<uint8_t> output) override;
38 uint32_t m_crc = 0xCE04B7;
39};
40
41} // namespace Botan
42
43#endif
void final(uint8_t out[])
Definition buf_comp.h:97
std::unique_ptr< HashFunction > new_object() const override
Definition crc24.h:29
void clear() override
Definition crc24.h:33
std::string name() const override
Definition crc24.h:23
size_t security_level() const override
Definition crc24.h:27
std::unique_ptr< HashFunction > copy_state() const override
Definition crc24.cpp:71
size_t output_length() const override
Definition crc24.h:25