Botan  2.1.0
Crypto and TLS for C++11
sha2_64.h
Go to the documentation of this file.
1 /*
2 * SHA-{384,512}
3 * (C) 1999-2010,2015 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_SHA_64BIT_H__
9 #define BOTAN_SHA_64BIT_H__
10 
11 #include <botan/mdx_hash.h>
12 
13 namespace Botan {
14 
15 /**
16 * SHA-384
17 */
18 class BOTAN_DLL SHA_384 final : public MDx_HashFunction
19  {
20  public:
21  std::string name() const override { return "SHA-384"; }
22  size_t output_length() const override { return 48; }
23  HashFunction* clone() const override { return new SHA_384; }
24 
25  void clear() override;
26 
27  SHA_384() : MDx_HashFunction(128, true, true, 16), m_digest(8)
28  { clear(); }
29  private:
30  void compress_n(const uint8_t[], size_t blocks) override;
31  void copy_out(uint8_t[]) override;
32 
33  secure_vector<uint64_t> m_digest;
34  };
35 
36 /**
37 * SHA-512
38 */
39 class BOTAN_DLL SHA_512 final : public MDx_HashFunction
40  {
41  public:
42  std::string name() const override { return "SHA-512"; }
43  size_t output_length() const override { return 64; }
44  HashFunction* clone() const override { return new SHA_512; }
45 
46  void clear() override;
47 
48  SHA_512() : MDx_HashFunction(128, true, true, 16), m_digest(8)
49  { clear(); }
50  private:
51  void compress_n(const uint8_t[], size_t blocks) override;
52  void copy_out(uint8_t[]) override;
53 
54  secure_vector<uint64_t> m_digest;
55  };
56 
57 /**
58 * SHA-512/256
59 */
60 class BOTAN_DLL SHA_512_256 final : public MDx_HashFunction
61  {
62  public:
63  std::string name() const override { return "SHA-512-256"; }
64  size_t output_length() const override { return 32; }
65  HashFunction* clone() const override { return new SHA_512_256; }
66 
67  void clear() override;
68 
69  SHA_512_256() : MDx_HashFunction(128, true, true, 16), m_digest(8) { clear(); }
70  private:
71  void compress_n(const uint8_t[], size_t blocks) override;
72  void copy_out(uint8_t[]) override;
73 
74  secure_vector<uint64_t> m_digest;
75  };
76 
77 }
78 
79 #endif
size_t output_length() const override
Definition: sha2_64.h:64
std::string name() const override
Definition: sha2_64.h:63
std::string name() const override
Definition: sha2_64.h:21
std::string name() const override
Definition: sha2_64.h:42
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
size_t output_length() const override
Definition: sha2_64.h:43
HashFunction * clone() const override
Definition: sha2_64.h:65
size_t output_length() const override
Definition: sha2_64.h:22
Definition: alg_id.cpp:13
HashFunction * clone() const override
Definition: sha2_64.h:23
HashFunction * clone() const override
Definition: sha2_64.h:44