Coverage Report

Created: 2023-06-07 07:00

/src/botan/build/include/botan/internal/adler32.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* Adler32
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_ADLER32_H_
9
#define BOTAN_ADLER32_H_
10
11
#include <botan/hash.h>
12
13
namespace Botan {
14
15
/**
16
* The Adler32 checksum, used in zlib
17
*/
18
class Adler32 final : public HashFunction {
19
   public:
20
0
      std::string name() const override { return "Adler32"; }
21
22
0
      size_t output_length() const override { return 4; }
23
24
0
      std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<Adler32>(); }
25
26
      std::unique_ptr<HashFunction> copy_state() const override;
27
28
0
      void clear() override {
29
0
         m_S1 = 1;
30
0
         m_S2 = 0;
31
0
      }
32
33
0
      Adler32() { clear(); }
34
35
0
      ~Adler32() { clear(); }
36
37
   private:
38
      void add_data(const uint8_t[], size_t) override;
39
      void final_result(uint8_t[]) override;
40
      uint16_t m_S1, m_S2;
41
};
42
43
}  // namespace Botan
44
45
#endif