diff options
author | Brad King <brad.king@kitware.com> | 2017-07-18 15:12:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-07-18 15:12:57 (GMT) |
commit | 407c7415f41fc27578bb0ab2c831e767de575531 (patch) | |
tree | 524a20772e67be615cc71f77f8b12d81cfc28963 /Source/cmSystemTools.cxx | |
parent | b10d919de763000801cbffd4f58cbd0c4a1ad7a0 (diff) | |
parent | c4de0a25ac8b7bb94205e24b5557331ed80d79b8 (diff) | |
download | CMake-407c7415f41fc27578bb0ab2c831e767de575531.zip CMake-407c7415f41fc27578bb0ab2c831e767de575531.tar.gz CMake-407c7415f41fc27578bb0ab2c831e767de575531.tar.bz2 |
Merge topic 'cmake-E-sha'
c4de0a25 Add sha1sum, sha224sum, sha256sum, sha384sum and sha512sum to command mode
c4647d84 Change ComputeFileMD5 to ComputeFileHash
501a4fee Add some unit tests for md5sum
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1021
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f7192e0..9f214c3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -934,19 +934,17 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname) #endif } -bool cmSystemTools::ComputeFileMD5(const std::string& source, char* md5out) +std::string cmSystemTools::ComputeFileHash(const std::string& source, + cmCryptoHash::Algo algo) { #if defined(CMAKE_BUILD_WITH_CMAKE) - cmCryptoHash md5(cmCryptoHash::AlgoMD5); - std::string const str = md5.HashFile(source); - strncpy(md5out, str.c_str(), 32); - return !str.empty(); + cmCryptoHash hash(algo); + return hash.HashFile(source); #else (void)source; - (void)md5out; - cmSystemTools::Message("md5sum not supported in bootstrapping mode", + cmSystemTools::Message("hashsum not supported in bootstrapping mode", "Error"); - return false; + return std::string(); #endif } |