forked from gchq/CyberChef
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSHA0.mjs
47 lines (40 loc) · 1.23 KB
/
SHA0.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @author n1474335 [[email protected]]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import {runHash} from "../lib/Hash.mjs";
/**
* SHA0 operation
*/
class SHA0 extends Operation {
/**
* SHA0 constructor
*/
constructor() {
super();
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. 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 = [
{
name: "Rounds",
type: "number",
value: 80
}
];
}
/**
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
return runHash("sha0", input, {rounds: args[0]});
}
}
export default SHA0;