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:40:43 (GMT) |
commit | 92f95aede99c76af2ccff09d5b9cc895539332d0 (patch) | |
tree | 5e4e5c34a11b94d71681781a7bd5b537f3c7e15a | |
parent | c326209fa351ca236778c462bcb0b85f6fa392f7 (diff) | |
download | CMake-92f95aede99c76af2ccff09d5b9cc895539332d0.zip CMake-92f95aede99c76af2ccff09d5b9cc895539332d0.tar.gz CMake-92f95aede99c76af2ccff09d5b9cc895539332d0.tar.bz2 |
string: Add support for SHA-3 algorithms
-rw-r--r-- | Help/command/string.rst | 8 | ||||
-rw-r--r-- | Source/cmStringCommand.cxx | 4 | ||||
-rw-r--r-- | Tests/CMakeTests/String-SHA3_224-Works.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/String-SHA3_256-Works.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/String-SHA3_384-Works.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/String-SHA3_512-Works.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/StringTest.cmake.in | 12 |
7 files changed, 31 insertions, 1 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst index ae9442d..77538f6 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -230,6 +230,14 @@ The supported ``<HASH>`` algorithm names are: US Secure Hash Algorithms, RFC 4634. ``SHA512`` US Secure Hash Algorithms, RFC 4634. +``SHA3_224`` + Keccak SHA-3. +``SHA3_256`` + Keccak SHA-3. +``SHA3_384`` + Keccak SHA-3. +``SHA3_512`` + Keccak SHA-3. Generation ^^^^^^^^^^ diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index f835445..603c990 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -36,7 +36,9 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args, } if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" || subCommand == "SHA256" || subCommand == "SHA384" || - subCommand == "SHA512") { + subCommand == "SHA512" || subCommand == "SHA3_224" || + subCommand == "SHA3_256" || subCommand == "SHA3_384" || + subCommand == "SHA3_512") { return this->HandleHashCommand(args); } if (subCommand == "TOLOWER") { diff --git a/Tests/CMakeTests/String-SHA3_224-Works.cmake b/Tests/CMakeTests/String-SHA3_224-Works.cmake new file mode 100644 index 0000000..6aeb91d --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_224-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_224 sha3_224 "sample input string\n") +message("${sha3_224}") diff --git a/Tests/CMakeTests/String-SHA3_256-Works.cmake b/Tests/CMakeTests/String-SHA3_256-Works.cmake new file mode 100644 index 0000000..cc7ea1a --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_256-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_256 sha3_256 "sample input string\n") +message("${sha3_256}") diff --git a/Tests/CMakeTests/String-SHA3_384-Works.cmake b/Tests/CMakeTests/String-SHA3_384-Works.cmake new file mode 100644 index 0000000..9341c3f --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_384-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_384 sha3_384 "sample input string\n") +message("${sha3_384}") diff --git a/Tests/CMakeTests/String-SHA3_512-Works.cmake b/Tests/CMakeTests/String-SHA3_512-Works.cmake new file mode 100644 index 0000000..cf4eddd --- /dev/null +++ b/Tests/CMakeTests/String-SHA3_512-Works.cmake @@ -0,0 +1,2 @@ +string(SHA3_512 sha3_512 "sample input string\n") +message("${sha3_512}") diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index a45b205..83655da 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -16,6 +16,14 @@ set(SHA384-Works-RESULT 0) set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee") set(SHA512-Works-RESULT 0) set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51") +set(SHA3_224-Works-RESULT 0) +set(SHA3_224-Works-STDERR "4272868085f4f25080681a7712509fd12e16dcda79bd356836dd2100") +set(SHA3_256-Works-RESULT 0) +set(SHA3_256-Works-STDERR "be0df472b6bd474417a166d12f2774f2ef5095e86f0a88ef4c78c703800cfc8a") +set(SHA3_384-Works-RESULT 0) +set(SHA3_384-Works-STDERR "935a17cc708443c1369549483656a4521af03a52e4f3b314566272017ccae03a2c5db838f6d4c156b1dc5c366182481b") +set(SHA3_512-Works-RESULT 0) +set(SHA3_512-Works-STDERR "471a85ed537e8f77f31412a089f22d836054ffa179599f87a5d7568927d8fa236b6793ded8a387d1de92398c967177bcc6361672a722bf736cb0f63a0956d5cf") set(TIMESTAMP-BadArg1-RESULT 1) set(TIMESTAMP-BadArg1-STDERR "string sub-command TIMESTAMP requires at least one argument") set(TIMESTAMP-BadArg2-RESULT 1) @@ -52,6 +60,10 @@ check_cmake_test(String SHA256-Works SHA384-Works SHA512-Works + SHA3_224-Works + SHA3_256-Works + SHA3_384-Works + SHA3_512-Works TIMESTAMP-BadArg1 TIMESTAMP-BadArg2 TIMESTAMP-BadArg3 |