Option structures added for hashing algorithms

This commit is contained in:
n1073645 2020-04-24 14:04:13 +01:00
parent 4c3324aea1
commit 57c1a03c4f
7 changed files with 100 additions and 14 deletions

View file

@ -20,11 +20,17 @@ 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.<br><br>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.<br><br>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
}
];
}
/**
@ -33,7 +39,7 @@ class SHA1 extends Operation {
* @returns {string}
*/
run(input, args) {
return runHash("sha1", input);
return runHash("sha1", input, {rounds: args[0]});
}
}