mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Option structures added for hashing algorithms
This commit is contained in:
parent
4c3324aea1
commit
57c1a03c4f
7 changed files with 100 additions and 14 deletions
|
@ -20,7 +20,7 @@ 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.<br><br><ul><li>SHA-512 operates on 64-bit words.</li><li>SHA-256 operates on 32-bit words.</li><li>SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.</li><li>SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.</li><li>SHA-512/224 and SHA-512/256 are truncated versions of SHA-512, but the initial values are generated using the method described in Federal Information Processing Standards (FIPS) PUB 180-4.</li></ul>";
|
||||
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.<br><br><ul><li>SHA-512 operates on 64-bit words.</li><li>SHA-256 operates on 32-bit words.</li><li>SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.</li><li>SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.</li><li>SHA-512/224 and SHA-512/256 are truncated versions of SHA-512, but the initial values are generated using the method described in Federal Information Processing Standards (FIPS) PUB 180-4.</li></ul> The message digest algorithm consists, by default, of 64 rounds.";
|
||||
this.infoURL = "https://wikipedia.org/wiki/SHA-2";
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "string";
|
||||
|
@ -29,6 +29,11 @@ class SHA2 extends Operation {
|
|||
"name": "Size",
|
||||
"type": "option",
|
||||
"value": ["512", "256", "384", "224", "512/256", "512/224"]
|
||||
},
|
||||
{
|
||||
name: "Rounds",
|
||||
type: "number",
|
||||
value: 64
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@ -40,7 +45,7 @@ class SHA2 extends Operation {
|
|||
*/
|
||||
run(input, args) {
|
||||
const size = args[0];
|
||||
return runHash("sha" + size, input);
|
||||
return runHash("sha" + size, input, {rounds: args[1]});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue