summaryrefslogtreecommitdiffstats
path: root/Source/cmCryptoHash.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-11-16 01:32:43 (GMT)
committerBrad King <brad.king@kitware.com>2011-11-16 15:15:44 (GMT)
commit38771d3bdf51b81d46578e0c81ebddbdea0ce3b2 (patch)
treecb83e9ed3b723144b427a5acf083fdc384953761 /Source/cmCryptoHash.h
parent73efd4a5044d2346e14d019197e2ddced3f9b7a8 (diff)
downloadCMake-38771d3bdf51b81d46578e0c81ebddbdea0ce3b2.zip
CMake-38771d3bdf51b81d46578e0c81ebddbdea0ce3b2.tar.gz
CMake-38771d3bdf51b81d46578e0c81ebddbdea0ce3b2.tar.bz2
Add file(SHA*) commands to compute cryptographic hashes
Add a file() command API for SHA1, SHA224, SHA256, SHA384, and SHA512.
Diffstat (limited to 'Source/cmCryptoHash.h')
-rw-r--r--Source/cmCryptoHash.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 670624c..c17104b 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -37,4 +37,25 @@ protected:
virtual std::string Finalize();
};
+#define cmCryptoHash_SHA_CLASS_DECL(SHA) \
+ class cmCryptoHash##SHA: public cmCryptoHash \
+ { \
+ union _SHA_CTX* SHA; \
+ public: \
+ cmCryptoHash##SHA(); \
+ ~cmCryptoHash##SHA(); \
+ protected: \
+ virtual void Initialize(); \
+ virtual void Append(unsigned char const* buf, int sz); \
+ virtual std::string Finalize(); \
+ }
+
+cmCryptoHash_SHA_CLASS_DECL(SHA1);
+cmCryptoHash_SHA_CLASS_DECL(SHA224);
+cmCryptoHash_SHA_CLASS_DECL(SHA256);
+cmCryptoHash_SHA_CLASS_DECL(SHA384);
+cmCryptoHash_SHA_CLASS_DECL(SHA512);
+
+#undef cmCryptoHash_SHA_CLASS_DECL
+
#endif