Commit 1dec5448 authored by Brad King's avatar Brad King
Browse files

ENH: Add cmSystemTools::ComputeStringMD5 method.

parent 02b1767e
......@@ -1129,6 +1129,17 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
#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)
{
......
......@@ -168,6 +168,9 @@ public:
///! 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment