summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
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/cmFileCommand.cxx
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/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 32454f5..35c743d 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -85,7 +85,12 @@ bool cmFileCommand
{
return this->HandleReadCommand(args);
}
- else if ( subCommand == "MD5" )
+ else if ( subCommand == "MD5" ||
+ subCommand == "SHA1" ||
+ subCommand == "SHA224" ||
+ subCommand == "SHA256" ||
+ subCommand == "SHA384" ||
+ subCommand == "SHA512" )
{
return this->HandleHashCommand(args);
}
@@ -358,6 +363,16 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
cmsys::auto_ptr<cmCryptoHash> hash;
if(args[0] == "MD5")
{ hash.reset(new cmCryptoHashMD5); }
+ else if(args[0] == "SHA1")
+ { hash.reset(new cmCryptoHashSHA1); }
+ else if(args[0] == "SHA224")
+ { hash.reset(new cmCryptoHashSHA224); }
+ else if(args[0] == "SHA256")
+ { hash.reset(new cmCryptoHashSHA256); }
+ else if(args[0] == "SHA384")
+ { hash.reset(new cmCryptoHashSHA384); }
+ else if(args[0] == "SHA512")
+ { hash.reset(new cmCryptoHashSHA512); }
if(hash.get())
{
std::string out = hash->HashFile(args[1].c_str());