2018-05-17 17:11:34 +02:00
/ * *
* @ author n1474335 [ n1474335 @ gmail . com ]
* @ copyright Crown Copyright 2016
* @ license Apache - 2.0
* /
2019-07-09 13:23:59 +02:00
import Operation from "../Operation.mjs" ;
import { runHash } from "../lib/Hash.mjs" ;
2018-05-17 17:11:34 +02:00
/ * *
* SHA0 operation
* /
class SHA0 extends Operation {
/ * *
* SHA0 constructor
* /
constructor ( ) {
super ( ) ;
this . name = "SHA0" ;
2018-12-26 00:58:00 +01:00
this . module = "Crypto" ;
2020-04-24 15:04:13 +02:00
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." ;
2018-08-21 20:07:13 +02:00
this . infoURL = "https://wikipedia.org/wiki/SHA-1#SHA-0" ;
2018-05-17 17:11:34 +02:00
this . inputType = "ArrayBuffer" ;
this . outputType = "string" ;
2020-04-24 15:04:13 +02:00
this . args = [
{
name : "Rounds" ,
type : "number" ,
2021-02-02 17:06:37 +01:00
value : 80 ,
min : 16
2020-04-24 15:04:13 +02:00
}
] ;
2018-05-17 17:11:34 +02:00
}
/ * *
* @ param { ArrayBuffer } input
* @ param { Object [ ] } args
* @ returns { string }
* /
run ( input , args ) {
2020-04-24 15:04:13 +02:00
return runHash ( "sha0" , input , { rounds : args [ 0 ] } ) ;
2018-05-17 17:11:34 +02:00
}
}
export default SHA0 ;