summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-03 17:21:41 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-10 13:29:38 (GMT)
commit5420278dc884c0382f271872b67c33978f3fe6b8 (patch)
treebbc69e42b2785521157da63324473b0f0d36fb64 /Source/cmGlobalGenerator.cxx
parent9a596b33bbfdb274ccf7f678c78cb8826c7c363b (diff)
downloadCMake-5420278dc884c0382f271872b67c33978f3fe6b8.zip
CMake-5420278dc884c0382f271872b67c33978f3fe6b8.tar.gz
CMake-5420278dc884c0382f271872b67c33978f3fe6b8.tar.bz2
Port hash computation to cmCryptoHash
Avoid using KWSys MD5 or `cm_sha2` and use the `cmCryptoHash` abstraction instead.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx13
1 files changed, 4 insertions, 9 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cf51c6a..42e9df1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -44,9 +44,9 @@
#include <string.h>
#if defined(CMAKE_BUILD_WITH_CMAKE)
+#include "cmCryptoHash.h"
#include <cm_jsoncpp_value.h>
#include <cm_jsoncpp_writer.h>
-#include <cmsys/MD5.h>
#endif
class cmInstalledFile;
@@ -2616,14 +2616,9 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
// Compute a hash of the rule.
RuleHash hash;
{
- unsigned char const* data =
- reinterpret_cast<unsigned char const*>(content.c_str());
- int length = static_cast<int>(content.length());
- cmsysMD5* sum = cmsysMD5_New();
- cmsysMD5_Initialize(sum);
- cmsysMD5_Append(sum, data, length);
- cmsysMD5_FinalizeHex(sum, hash.Data);
- cmsysMD5_Delete(sum);
+ cmCryptoHash md5(cmCryptoHash::AlgoMD5);
+ std::string const md5_hex = md5.HashString(content);
+ memcpy(hash.Data, md5_hex.c_str(), 32);
}
// Shorten the output name (in expected use case).