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" ;
2018-05-17 17:11:34 +02:00
import JSCRC from "js-crc" ;
/ * *
* CRC - 16 Checksum operation
* /
class CRC16Checksum extends Operation {
/ * *
* CRC16Checksum constructor
* /
constructor ( ) {
super ( ) ;
this . name = "CRC-16 Checksum" ;
2018-12-26 00:58:00 +01:00
this . module = "Crypto" ;
2018-05-17 17:11:34 +02:00
this . description = "A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.<br><br>The CRC was invented by W. Wesley Peterson in 1961." ;
2018-08-21 20:07:13 +02:00
this . infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check" ;
2018-05-17 17:11:34 +02:00
this . inputType = "ArrayBuffer" ;
this . outputType = "string" ;
this . args = [ ] ;
}
/ * *
* @ param { ArrayBuffer } input
* @ param { Object [ ] } args
* @ returns { string }
* /
run ( input , args ) {
return JSCRC . crc16 ( input ) ;
}
}
export default CRC16Checksum ;