blob: a767b3d103363c9002c565d0f9136c5f63f0c8df (
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
55
56
57
|
/*************************************************
* SHA-{224,256} Header File *
* (C) 1999-2008 Jack Lloyd *
* 2007 FlexSecure GmbH *
*************************************************/
#ifndef BOTAN_SHA_256_H__
#define BOTAN_SHA_256_H__
#include <botan/mdx_hash.h>
namespace Botan {
/*************************************************
* SHA-{224,256} Base *
*************************************************/
class BOTAN_DLL SHA_224256_BASE : public MDx_HashFunction
{
protected:
void clear() throw();
SHA_224256_BASE(u32bit out) :
MDx_HashFunction(out, 64, true, true) { clear(); }
SecureBuffer<u32bit, 64> W;
SecureBuffer<u32bit, 8> digest;
private:
void hash(const byte[]);
void copy_out(byte[]);
};
/*************************************************
* SHA-224 *
*************************************************/
class BOTAN_DLL SHA_224 : public SHA_224256_BASE
{
public:
void clear() throw();
std::string name() const { return "SHA-224"; }
HashFunction* clone() const { return new SHA_224; }
SHA_224() : SHA_224256_BASE(28) { clear(); }
};
/*************************************************
* SHA-256 *
*************************************************/
class BOTAN_DLL SHA_256 : public SHA_224256_BASE
{
public:
void clear() throw();
std::string name() const { return "SHA-256"; }
HashFunction* clone() const { return new SHA_256; }
SHA_256() : SHA_224256_BASE(32) { clear (); }
};
}
#endif
|