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 protected:
00028         static const word32 K[64];
00029 };
00030 
00031 //! implements the SHA-224 standard
00032 class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28>
00033 {
00034 public:
00035         static void CRYPTOPP_API InitState(HashWordType *state);
00036         static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
00037         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
00038 };
00039 
00040 #ifdef WORD64_AVAILABLE
00041 
00042 //! implements the SHA-512 standard
00043 class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512>
00044 {
00045 public:
00046         static void CRYPTOPP_API InitState(HashWordType *state);
00047         static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
00048         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
00049 
00050 protected:
00051         static const word64 K[80];
00052 };
00053 
00054 //! implements the SHA-384 standard
00055 class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48>
00056 {
00057 public:
00058         static void CRYPTOPP_API InitState(HashWordType *state);
00059         static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
00060         static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
00061 };
00062 
00063 #endif
00064 
00065 NAMESPACE_END
00066 
00067 #endif

Generated on Sat Dec 23 02:07:10 2006 for Crypto++ by  doxygen 1.5.1-p1