[cmake-commits] king committed cmSystemTools.cxx 1.358 1.359 cmSystemTools.h 1.146 1.147

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Jan 24 14:41:20 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv17914/Source

Modified Files:
	cmSystemTools.cxx cmSystemTools.h 
Log Message:
ENH: Add cmSystemTools::ComputeStringMD5 method.


Index: cmSystemTools.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.h,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- cmSystemTools.h	1 Jan 2008 20:13:41 -0000	1.146
+++ cmSystemTools.h	24 Jan 2008 19:41:18 -0000	1.147
@@ -168,6 +168,9 @@
   ///! Compute the md5sum of a file
   static bool ComputeFileMD5(const char* source, char* md5out);
 
+  /** Compute the md5sum of a string.  */
+  static std::string ComputeStringMD5(const char* input);
+
   /**
    * Run an executable command and put the stdout in output.
    * A temporary file is created in the binaryDir for storing the

Index: cmSystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- cmSystemTools.cxx	1 Jan 2008 20:13:41 -0000	1.358
+++ cmSystemTools.cxx	24 Jan 2008 19:41:18 -0000	1.359
@@ -1129,6 +1129,17 @@
 #endif
 }
 
+std::string cmSystemTools::ComputeStringMD5(const char* input)
+{
+  char md5out[32];
+  cmsysMD5* md5 = cmsysMD5_New();
+  cmsysMD5_Initialize(md5);
+  cmsysMD5_Append(md5, reinterpret_cast<unsigned char const*>(input), -1);
+  cmsysMD5_FinalizeHex(md5, md5out);
+  cmsysMD5_Delete(md5);
+  return std::string(md5out, 32);
+}
+
 void cmSystemTools::Glob(const char *directory, const char *regexp,
                          std::vector<std::string>& files)
 {



More information about the Cmake-commits mailing list