2018-05-17 15:11:34 +00:00
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
2019-07-09 12:23:59 +01:00
import Operation from "../Operation.mjs" ;
2018-05-17 15:11:34 +00: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-25 23:58:00 +00:00
this . module = "Crypto" ;
2018-05-17 15:11:34 +00: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 19:07:13 +01:00
this . infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check" ;
2018-05-17 15:11:34 +00: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 ;