00001
00002
00003
00004
00005
00006
00007 #ifndef CRYPTOPP_SHA_H
00008 #define CRYPTOPP_SHA_H
00009
00010 #include "config.h"
00011 #include "iterhash.h"
00012
00013 NAMESPACE_BEGIN(CryptoPP)
00014
00015
00016 class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
00017 {
00018 public:
00019 static void CRYPTOPP_API InitState(HashWordType *state);
00020 static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
00021 static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
00022 };
00023
00024 typedef SHA1 SHA;
00025
00026
00027 class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true>
00028 {
00029 public:
00030 #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
00031 size_t HashMultipleBlocks(const word32 *input, size_t length);
00032 #endif
00033 static void CRYPTOPP_API InitState(HashWordType *state);
00034 static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
00035 static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
00036 };
00037
00038
00039 class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true>
00040 {
00041 public:
00042 #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
00043 size_t HashMultipleBlocks(const word32 *input, size_t length);
00044 #endif
00045 static void CRYPTOPP_API InitState(HashWordType *state);
00046 static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
00047 static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
00048 };
00049
00050
00051 class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>
00052 {
00053 public:
00054 static void CRYPTOPP_API InitState(HashWordType *state);
00055 static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
00056 static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
00057 };
00058
00059
00060 class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, (CRYPTOPP_BOOL_X86|CRYPTOPP_BOOL_X32)>
00061 {
00062 public:
00063 static void CRYPTOPP_API InitState(HashWordType *state);
00064 static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
00065 static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
00066 };
00067
00068 NAMESPACE_END
00069
00070 #endif