diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad2e3fc3..c60b7c3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,8 +13,11 @@ All major and minor version changes will be documented in this file. Details of
## Details
+### [9.24.0] - 2020-02-02
+- 'SM3' hashing function added along with more configuration options for other hashing operations [@n1073645] [@n1474335] | [#1022]
+
### [9.23.0] - 2020-02-01
-- Various RSA operations added to encrypt, decrypt, sign, verify and generate keys [@mattnotmitt] | [#652]
+- Various RSA operations added to encrypt, decrypt, sign, verify and generate keys [@mattnotmitt] [@GCHQ77703] | [#652]
### [9.22.0] - 2021-02-01
- 'Unicode Text Format' operation added [@mattnotmitt] | [#1083]
@@ -420,5 +423,6 @@ All major and minor version changes will be documented in this file. Details of
[#965]: https://github.com/gchq/CyberChef/pull/965
[#966]: https://github.com/gchq/CyberChef/pull/966
[#987]: https://github.com/gchq/CyberChef/pull/987
+[#1022]: https://github.com/gchq/CyberChef/pull/1022
[#1049]: https://github.com/gchq/CyberChef/pull/1049
[#1083]: https://github.com/gchq/CyberChef/pull/1083
\ No newline at end of file
diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json
index 1afa6dcb..9558a87d 100755
--- a/src/core/config/Categories.json
+++ b/src/core/config/Categories.json
@@ -319,6 +319,7 @@
"SHA1",
"SHA2",
"SHA3",
+ "SM3",
"Keccak",
"Shake",
"RIPEMD",
diff --git a/src/core/operations/HAS160.mjs b/src/core/operations/HAS160.mjs
index aa1439ae..707b99b3 100644
--- a/src/core/operations/HAS160.mjs
+++ b/src/core/operations/HAS160.mjs
@@ -20,11 +20,19 @@ class HAS160 extends Operation {
this.name = "HAS-160";
this.module = "Crypto";
- this.description = "HAS-160 is a cryptographic hash function designed for use with the Korean KCDSA digital signature algorithm. It is derived from SHA-1, with assorted changes intended to increase its security. It produces a 160-bit output.
HAS-160 is used in the same way as SHA-1. First it divides input in blocks of 512 bits each and pads the final block. A digest function updates the intermediate hash value by processing the input blocks in turn.
The message digest algorithm consists of 80 rounds.";
+ this.description = "HAS-160 is a cryptographic hash function designed for use with the Korean KCDSA digital signature algorithm. It is derived from SHA-1, with assorted changes intended to increase its security. It produces a 160-bit output.
HAS-160 is used in the same way as SHA-1. First it divides input in blocks of 512 bits each and pads the final block. A digest function updates the intermediate hash value by processing the input blocks in turn.
The message digest algorithm consists, by default, of 80 rounds.";
this.infoURL = "https://wikipedia.org/wiki/HAS-160";
this.inputType = "ArrayBuffer";
this.outputType = "string";
- this.args = [];
+ this.args = [
+ {
+ name: "Rounds",
+ type: "number",
+ value: 80,
+ min: 1,
+ max: 80
+ }
+ ];
}
/**
@@ -33,7 +41,7 @@ class HAS160 extends Operation {
* @returns {string}
*/
run(input, args) {
- return runHash("has160", input);
+ return runHash("has160", input, {rounds: args[0]});
}
}
diff --git a/src/core/operations/MD2.mjs b/src/core/operations/MD2.mjs
index ecfa699c..38f6d325 100644
--- a/src/core/operations/MD2.mjs
+++ b/src/core/operations/MD2.mjs
@@ -20,11 +20,18 @@ class MD2 extends Operation {
this.name = "MD2";
this.module = "Crypto";
- this.description = "The MD2 (Message-Digest 2) algorithm is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers.
Although MD2 is no longer considered secure, even as of 2014, it remains in use in public key infrastructures as part of certificates generated with MD2 and RSA.";
+ this.description = "The MD2 (Message-Digest 2) algorithm is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers.
Although MD2 is no longer considered secure, even as of 2014, it remains in use in public key infrastructures as part of certificates generated with MD2 and RSA. The message digest algorithm consists, by default, of 18 rounds.";
this.infoURL = "https://wikipedia.org/wiki/MD2_(cryptography)";
this.inputType = "ArrayBuffer";
this.outputType = "string";
- this.args = [];
+ this.args = [
+ {
+ name: "Rounds",
+ type: "number",
+ value: 18,
+ min: 0
+ }
+ ];
}
/**
@@ -33,7 +40,7 @@ class MD2 extends Operation {
* @returns {string}
*/
run(input, args) {
- return runHash("md2", input);
+ return runHash("md2", input, {rounds: args[0]});
}
}
diff --git a/src/core/operations/SHA0.mjs b/src/core/operations/SHA0.mjs
index 93345eb2..7f712ad9 100644
--- a/src/core/operations/SHA0.mjs
+++ b/src/core/operations/SHA0.mjs
@@ -20,11 +20,18 @@ class SHA0 extends Operation {
this.name = "SHA0";
this.module = "Crypto";
- this.description = "SHA-0 is a retronym applied to the original version of the 160-bit hash function published in 1993 under the name 'SHA'. It was withdrawn shortly after publication due to an undisclosed 'significant flaw' and replaced by the slightly revised version SHA-1.";
+ this.description = "SHA-0 is a retronym applied to the original version of the 160-bit hash function published in 1993 under the name 'SHA'. It was withdrawn shortly after publication due to an undisclosed 'significant flaw' and replaced by the slightly revised version SHA-1. The message digest algorithm consists, by default, of 80 rounds.";
this.infoURL = "https://wikipedia.org/wiki/SHA-1#SHA-0";
this.inputType = "ArrayBuffer";
this.outputType = "string";
- this.args = [];
+ this.args = [
+ {
+ name: "Rounds",
+ type: "number",
+ value: 80,
+ min: 16
+ }
+ ];
}
/**
@@ -33,7 +40,7 @@ class SHA0 extends Operation {
* @returns {string}
*/
run(input, args) {
- return runHash("sha0", input);
+ return runHash("sha0", input, {rounds: args[0]});
}
}
diff --git a/src/core/operations/SHA1.mjs b/src/core/operations/SHA1.mjs
index 41a0105a..8c081f2f 100644
--- a/src/core/operations/SHA1.mjs
+++ b/src/core/operations/SHA1.mjs
@@ -20,11 +20,18 @@ class SHA1 extends Operation {
this.name = "SHA1";
this.module = "Crypto";
- this.description = "The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.
However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.";
+ this.description = "The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.
However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved. The message digest algorithm consists, by default, of 80 rounds.";
this.infoURL = "https://wikipedia.org/wiki/SHA-1";
this.inputType = "ArrayBuffer";
this.outputType = "string";
- this.args = [];
+ this.args = [
+ {
+ name: "Rounds",
+ type: "number",
+ value: 80,
+ min: 16
+ }
+ ];
}
/**
@@ -33,7 +40,7 @@ class SHA1 extends Operation {
* @returns {string}
*/
run(input, args) {
- return runHash("sha1", input);
+ return runHash("sha1", input, {rounds: args[0]});
}
}
diff --git a/src/core/operations/SHA2.mjs b/src/core/operations/SHA2.mjs
index c9599d24..ecdc4cc5 100644
--- a/src/core/operations/SHA2.mjs
+++ b/src/core/operations/SHA2.mjs
@@ -20,15 +20,58 @@ class SHA2 extends Operation {
this.name = "SHA2";
this.module = "Crypto";
- this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.