sha.h

00001 #ifndef CRYPTOPP_SHA_H
00002 #define CRYPTOPP_SHA_H
00003 
00004 #include "iterhash.h"
00005 
00006 NAMESPACE_BEGIN(CryptoPP)
00007 
00008 /// <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a>
00009 class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
00010 {
00011 public:
00012         static void CRYPTOPP_API InitState(HashWordType *state);
00013         static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
00014         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
00015 };
00016 
00017 typedef SHA1 SHA;       // for backwards compatibility
00018 
00019 //! implements the SHA-256 standard
00020 class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256>
00021 {
00022 public:
00023         static void CRYPTOPP_API InitState(HashWordType *state);
00024         static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
00025         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
00026 };
00027 
00028 //! implements the SHA-224 standard
00029 class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28>
00030 {
00031 public:
00032         static void CRYPTOPP_API InitState(HashWordType *state);
00033         static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
00034         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
00035 };
00036 
00037 #ifdef WORD64_AVAILABLE
00038 
00039 //! implements the SHA-512 standard
00040 class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512>
00041 {
00042 public:
00043         static void CRYPTOPP_API InitState(HashWordType *state);
00044         static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
00045         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
00046 };
00047 
00048 //! implements the SHA-384 standard
00049 class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48>
00050 {
00051 public:
00052         static void CRYPTOPP_API InitState(HashWordType *state);
00053         static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
00054         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
00055 };
00056 
00057 #endif
00058 
00059 NAMESPACE_END
00060 
00061 #endif

Generated on Fri Jun 1 11:11:24 2007 for Crypto++ by  doxygen 1.5.2