Fabcoin Core  0.16.2
P2P Digital Currency
sha.h
Go to the documentation of this file.
1 // sha.h - written and placed in the public domain by Wei Dai
2 
6 
7 #ifndef CRYPTOPP_SHA_H
8 #define CRYPTOPP_SHA_H
9 
10 #include "config.h"
11 #include "iterhash.h"
12 
13 // Clang 3.3 integrated assembler crash on Linux
14 // http://github.com/weidai11/cryptopp/issues/264
15 #if defined(CRYPTOPP_LLVM_CLANG_VERSION) && (CRYPTOPP_LLVM_CLANG_VERSION < 30400)
16 # define CRYPTOPP_DISABLE_SHA_ASM
17 #endif
18 
20 
26 {
27 public:
28  static void CRYPTOPP_API InitState(HashWordType *state);
29  static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
31 };
32 
33 typedef SHA1 SHA; // for backwards compatibility
34 
39 class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true>
40 {
41 public:
42 #if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
43  size_t HashMultipleBlocks(const word32 *input, size_t length);
44 #endif
45  static void CRYPTOPP_API InitState(HashWordType *state);
46  static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
48 };
49 
54 class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true>
55 {
56 public:
57 #if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
58  size_t HashMultipleBlocks(const word32 *input, size_t length);
59 #endif
60  static void CRYPTOPP_API InitState(HashWordType *state);
61  static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
63 };
64 
69 class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>
70 {
71 public:
72  static void CRYPTOPP_API InitState(HashWordType *state);
73  static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
75 };
76 
81 class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>
82 {
83 public:
84  static void CRYPTOPP_API InitState(HashWordType *state);
85  static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
87 };
88 
90 
91 #endif
SHA-384 message digest.
Definition: sha.h:81
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
Definition: sha.h:74
#define CRYPTOPP_STATIC_CONSTEXPR
Definition: config.h:892
SHA-256 message digest.
Definition: sha.h:39
Iterated hash with a static transformation function.
Definition: iterhash.h:150
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
Converts an enumeration to a type suitable for use as a template parameter.
Definition: cryptlib.h:116
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
Definition: sha.h:47
Library configuration file.
SHA-512 message digest.
Definition: sha.h:69
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data)
Definition: sha.h:85
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
Definition: sha.h:62
SHA-1 message digest.
Definition: sha.h:25
#define CRYPTOPP_API
Definition: config.h:705
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
Definition: sha.h:30
unsigned long long word64
Definition: config.h:240
SHA1 SHA
Definition: sha.h:33
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data)
Definition: sha.cpp:1092
virtual size_t HashMultipleBlocks(const T_HashWordType *input, size_t length)
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
Definition: sha.h:86
#define NAMESPACE_END
Definition: config.h:201
#define CRYPTOPP_DLL
Definition: config.h:704
unsigned int word32
Definition: config.h:231
SHA-224 message digest.
Definition: sha.h:54
uint8_t const * data
Definition: sha3.h:19
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data)
Definition: sha.h:61
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data)
Definition: sha.cpp:1364