|  | @@ -10,6 +10,8 @@
 | 
	
		
			
				|  |  |    See the License for more information.
 | 
	
		
			
				|  |  |  ============================================================================*/
 | 
	
		
			
				|  |  |  #include "cmStringCommand.h"
 | 
	
		
			
				|  |  | +#include "cmCryptoHash.h"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  #include <cmsys/RegularExpression.hxx>
 | 
	
		
			
				|  |  |  #include <cmsys/SystemTools.hxx>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -36,6 +38,15 @@ bool cmStringCommand
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |      return this->HandleReplaceCommand(args);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +  else if ( subCommand == "MD5" ||
 | 
	
		
			
				|  |  | +            subCommand == "SHA1" ||
 | 
	
		
			
				|  |  | +            subCommand == "SHA224" ||
 | 
	
		
			
				|  |  | +            subCommand == "SHA256" ||
 | 
	
		
			
				|  |  | +            subCommand == "SHA384" ||
 | 
	
		
			
				|  |  | +            subCommand == "SHA512" )
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +    return this->HandleHashCommand(args);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    else if(subCommand == "TOLOWER")
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |      return this->HandleToUpperLowerCommand(args, false);
 | 
	
	
		
			
				|  | @@ -82,6 +93,27 @@ bool cmStringCommand
 | 
	
		
			
				|  |  |    return false;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +//----------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +  if(args.size() != 3)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +    cmOStringStream e;
 | 
	
		
			
				|  |  | +    e << args[0] << " requires an output variable and an input string";
 | 
	
		
			
				|  |  | +    this->SetError(e.str().c_str());
 | 
	
		
			
				|  |  | +    return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
 | 
	
		
			
				|  |  | +  if(hash.get())
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +    std::string out = hash->HashString(args[2].c_str());
 | 
	
		
			
				|  |  | +    this->Makefile->AddDefinition(args[1].c_str(), out.c_str());
 | 
	
		
			
				|  |  | +    return true;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  return false;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  //----------------------------------------------------------------------------
 | 
	
		
			
				|  |  |  bool cmStringCommand::HandleToUpperLowerCommand(
 | 
	
		
			
				|  |  |    std::vector<std::string> const& args, bool toUpper)
 |