Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

# 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 SHA : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA>
    00010 {
    00011 public:
    00012         static void InitState(HashWordType *state);
    00013         static void Transform(word32 *digest, const word32 *data);
    00014         static const char *StaticAlgorithmName() {return "SHA-1";}
    00015 };
    00016
    00017 typedef SHA SHA1;
    00018
    00019 //! implements the SHA-256 standard
    00020 class SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256>
    00021 {
    00022 public:
    00023         static void InitState(HashWordType *state);
    00024         static void Transform(word32 *digest, const word32 *data);
    00025         static const char *StaticAlgorithmName() {return "SHA-256";}
    00026
    00027 protected:
    00028         static const word32 K[64];
    00029 };
    00030
    00031 #ifdef WORD64_AVAILABLE
    00032
    00033 //! implements the SHA-512 standard
    00034 class SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512>
    00035 {
    00036 public:
    00037         static void InitState(HashWordType *state);
    00038         static void Transform(word64 *digest, const word64 *data);
    00039         static const char *StaticAlgorithmName() {return "SHA-512";}
    00040
    00041 protected:
    00042         static const word64 K[80];
    00043 };
    00044
    00045 //! implements the SHA-384 standard
    00046 class SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48>
    00047 {
    00048 public:
    00049         static void InitState(HashWordType *state);
    00050         static void Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
    00051         static const char *StaticAlgorithmName() {return "SHA-384";}
    00052 };
    00053
    00054 #endif
    00055
    00056 NAMESPACE_END
    00057
    00058 #endif