monotone

monotone Mtn Source Tree

Root/cryptopp/sha.h

1#ifndef CRYPTOPP_SHA_H
2#define CRYPTOPP_SHA_H
3
4#include "iterhash.h"
5
6NAMESPACE_BEGIN(CryptoPP)
7
8/// <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a>
9class SHA : public IteratedHashWithStaticTransform<word32, BigEndian, 64, SHA>
10{
11public:
12enum {DIGESTSIZE = 20};
13SHA() : IteratedHashWithStaticTransform<word32, BigEndian, 64, SHA>(DIGESTSIZE) {Init();}
14static void Transform(word32 *digest, const word32 *data);
15static const char *StaticAlgorithmName() {return "SHA-1";}
16
17protected:
18void Init();
19};
20
21typedef SHA SHA1;
22
23//! implements the SHA-256 standard
24class SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, SHA256>
25{
26public:
27enum {DIGESTSIZE = 32};
28SHA256() : IteratedHashWithStaticTransform<word32, BigEndian, 64, SHA256>(DIGESTSIZE) {Init();}
29static void Transform(word32 *digest, const word32 *data);
30static const char *StaticAlgorithmName() {return "SHA-256";}
31
32protected:
33void Init();
34
35static const word32 K[64];
36};
37
38#ifdef WORD64_AVAILABLE
39
40//! implements the SHA-512 standard
41class SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, SHA512>
42{
43public:
44enum {DIGESTSIZE = 64};
45SHA512() : IteratedHashWithStaticTransform<word64, BigEndian, 128, SHA512>(DIGESTSIZE) {Init();}
46static void Transform(word64 *digest, const word64 *data);
47static const char *StaticAlgorithmName() {return "SHA-512";}
48
49protected:
50void Init();
51
52static const word64 K[80];
53};
54
55//! implements the SHA-384 standard
56class SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, SHA512>
57{
58public:
59enum {DIGESTSIZE = 48};
60SHA384() : IteratedHashWithStaticTransform<word64, BigEndian, 128, SHA512>(64) {Init();}
61unsigned int DigestSize() const {return DIGESTSIZE;};
62static const char *StaticAlgorithmName() {return "SHA-384";}
63
64protected:
65void Init();
66};
67
68#endif
69
70NAMESPACE_END
71
72#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status