aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/sha2/sha2_32.h
blob: 71f0cff4b0d0123a6729aef5853edab2400745f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* SHA-{224,256}
* (C) 1999-2010 Jack Lloyd
*     2007 FlexSecure GmbH
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_SHA_224_256_H__
#define BOTAN_SHA_224_256_H__

#include <botan/mdx_hash.h>

namespace Botan {

/**
* SHA-224
*/
class BOTAN_DLL SHA_224 : public MDx_HashFunction
   {
   public:
      void clear();
      std::string name() const { return "SHA-224"; }
      HashFunction* clone() const { return new SHA_224; }
      SHA_224() : MDx_HashFunction(28, 64, true, true) { clear(); }
   private:
      void compress_n(const byte[], u32bit blocks);
      void copy_out(byte[]);

      SecureVector<u32bit, 64> W;
      SecureVector<u32bit, 8> digest;
   };

/**
* SHA-256
*/
class BOTAN_DLL SHA_256 : public MDx_HashFunction
   {
   public:
      void clear();
      std::string name() const { return "SHA-256"; }
      HashFunction* clone() const { return new SHA_256; }
      SHA_256() : MDx_HashFunction(32, 64, true, true) { clear(); }
   private:
      void compress_n(const byte[], u32bit blocks);
      void copy_out(byte[]);

      SecureVector<u32bit, 64> W;
      SecureVector<u32bit, 8> digest;
   };

}

#endif