Botan  1.10.9
sha2_32.h
Go to the documentation of this file.
1 /*
2 * SHA-{224,256}
3 * (C) 1999-2011 Jack Lloyd
4 * 2007 FlexSecure GmbH
5 *
6 * Distributed under the terms of the Botan license
7 */
8 
9 #ifndef BOTAN_SHA_224_256_H__
10 #define BOTAN_SHA_224_256_H__
11 
12 #include <botan/mdx_hash.h>
13 
14 namespace Botan {
15 
16 /**
17 * SHA-224
18 */
19 class BOTAN_DLL SHA_224 : public MDx_HashFunction
20  {
21  public:
22  std::string name() const { return "SHA-224"; }
23  size_t output_length() const { return 28; }
24  HashFunction* clone() const { return new SHA_224; }
25 
26  void clear();
27 
28  SHA_224() : MDx_HashFunction(64, true, true), digest(8)
29  { clear(); }
30  private:
31  void compress_n(const byte[], size_t blocks);
32  void copy_out(byte[]);
33 
34  SecureVector<u32bit> digest;
35  };
36 
37 /**
38 * SHA-256
39 */
40 class BOTAN_DLL SHA_256 : public MDx_HashFunction
41  {
42  public:
43  std::string name() const { return "SHA-256"; }
44  size_t output_length() const { return 32; }
45  HashFunction* clone() const { return new SHA_256; }
46 
47  void clear();
48 
49  SHA_256() : MDx_HashFunction(64, true, true), digest(8)
50  { clear(); }
51  private:
52  void compress_n(const byte[], size_t blocks);
53  void copy_out(byte[]);
54 
55  SecureVector<u32bit> digest;
56  };
57 
58 }
59 
60 #endif
HashFunction * clone() const
Definition: sha2_32.h:45
std::string name() const
Definition: sha2_32.h:22
unsigned char byte
Definition: types.h:22
size_t output_length() const
Definition: sha2_32.h:23
size_t output_length() const
Definition: sha2_32.h:44
std::string name() const
Definition: sha2_32.h:43
HashFunction * clone() const
Definition: sha2_32.h:24