diff options
author | Brad King <brad.king@kitware.com> | 2016-11-10 21:31:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-11-10 21:38:34 (GMT) |
commit | c326209fa351ca236778c462bcb0b85f6fa392f7 (patch) | |
tree | 88a72e93820237586240a634f03df764c0268a5f /Source/cmCryptoHash.cxx | |
parent | 979e8ba6c6c6ed538b1dd9d60d89d863e7c4273c (diff) | |
download | CMake-c326209fa351ca236778c462bcb0b85f6fa392f7.zip CMake-c326209fa351ca236778c462bcb0b85f6fa392f7.tar.gz CMake-c326209fa351ca236778c462bcb0b85f6fa392f7.tar.bz2 |
cmCryptoHash: Add support for SHA-3 algorithms
Diffstat (limited to 'Source/cmCryptoHash.cxx')
-rw-r--r-- | Source/cmCryptoHash.cxx | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index f440999..d5807b1 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -9,12 +9,16 @@ static unsigned int const cmCryptoHashAlgoToId[] = { /* clang-format needs this comment to break after the opening brace */ - RHASH_MD5, // - RHASH_SHA1, // - RHASH_SHA224, // - RHASH_SHA256, // - RHASH_SHA384, // - RHASH_SHA512 + RHASH_MD5, // + RHASH_SHA1, // + RHASH_SHA224, // + RHASH_SHA256, // + RHASH_SHA384, // + RHASH_SHA512, // + RHASH_SHA3_224, // + RHASH_SHA3_256, // + RHASH_SHA3_384, // + RHASH_SHA3_512 }; static int cmCryptoHash_rhash_library_initialized; @@ -59,6 +63,18 @@ CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo) if (strcmp(algo, "SHA512") == 0) { return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA512)); } + if (strcmp(algo, "SHA3_224") == 0) { + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_224)); + } + if (strcmp(algo, "SHA3_256") == 0) { + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_256)); + } + if (strcmp(algo, "SHA3_384") == 0) { + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_384)); + } + if (strcmp(algo, "SHA3_512") == 0) { + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_512)); + } return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR); } |