From 550ab403f632458d15312ecd10d8c8f74b752f46 Mon Sep 17 00:00:00 2001 From: mshwed Date: Sun, 30 Jun 2019 21:28:00 -0400 Subject: [PATCH 1/5] Initial operation setup --- src/core/config/Categories.json | 1 + src/core/operations/CRC8Checksum.mjs | 56 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/core/operations/CRC8Checksum.mjs diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 102d76aa..20a09fba 100755 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -316,6 +316,7 @@ "Fletcher-32 Checksum", "Fletcher-64 Checksum", "Adler-32 Checksum", + "CRC-8 Checksum", "CRC-16 Checksum", "CRC-32 Checksum", "TCP/IP Checksum" diff --git a/src/core/operations/CRC8Checksum.mjs b/src/core/operations/CRC8Checksum.mjs new file mode 100644 index 00000000..0cb4eaba --- /dev/null +++ b/src/core/operations/CRC8Checksum.mjs @@ -0,0 +1,56 @@ +/** + * @author mshwed [m@ttshwed.com] + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; + +/** + * CRC-8 Checksum operation + */ +class CRC8Checksum extends Operation { + + /** + * CRC8Checksum constructor + */ + constructor() { + super(); + + this.name = "CRC-8 Checksum"; + this.module = "Crypto"; + this.description = ""; + this.infoURL = ""; + this.inputType = "ArrayBuffer"; + this.outputType = "string"; + this.args = [ + /* Example arguments. See the project wiki for full details. + { + name: "First arg", + type: "string", + value: "Don't Panic" + }, + { + name: "Second arg", + type: "number", + value: 42 + } + */ + ]; + } + + /** + * @param {byteArray} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + // const [firstArg, secondArg] = args; + + throw new OperationError("Test"); + } + +} + +export default CRC8Checksum; From 4c9a61f5a72d23303b5b859d0902169697689e20 Mon Sep 17 00:00:00 2001 From: mshwed Date: Mon, 1 Jul 2019 19:02:07 -0400 Subject: [PATCH 2/5] Added bit reversal --- src/core/operations/CRC8Checksum.mjs | 54 ++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/core/operations/CRC8Checksum.mjs b/src/core/operations/CRC8Checksum.mjs index 0cb4eaba..fdcd5d1d 100644 --- a/src/core/operations/CRC8Checksum.mjs +++ b/src/core/operations/CRC8Checksum.mjs @@ -5,7 +5,6 @@ */ import Operation from "../Operation"; -import OperationError from "../errors/OperationError"; /** * CRC-8 Checksum operation @@ -25,19 +24,36 @@ class CRC8Checksum extends Operation { this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ - /* Example arguments. See the project wiki for full details. { - name: "First arg", - type: "string", - value: "Don't Panic" - }, - { - name: "Second arg", - type: "number", - value: 42 + "name": "Algorithm", + "type": "option", + "value": [ + "CRC-8" + ] } - */ - ]; + ] + } + + calculateCRC8(algorithmName, polynomial, initializationValue, refIn, refOut, xorOut, check) { + let initializationValue = this.reverseBits(); + + return crc; + } + + /** + * For an 8 bit initialization value reverse the bits. + * + * @param input + */ + reverseBits(input) { + let reflectedBits = input.toString(2).split(''); + for (let i = 0; i < hashSize / 2; i++) { + let x = reflectedBits[i]; + reflectedBits[i] = reflectedBits[hashSize - i - 1]; + reflectedBits[hashSize - i - 1] = x; + } + + return parseInt(reflectedBits.join('')); } /** @@ -46,11 +62,21 @@ class CRC8Checksum extends Operation { * @returns {string} */ run(input, args) { - // const [firstArg, secondArg] = args; + const algorithm = args[0]; - throw new OperationError("Test"); + if (algorithm === "CRC-8") { + return this.calculateCRC8(algorithm, 0x7, 0x0, false, false, 0x0, 0xF4) + } + + return ""; } } +const hashSize = 8; + +// const CRC8AlgoParameters = { +// 'CRC8' +// } + export default CRC8Checksum; From bc1bd2427d196fcb970ea31e962154ac4a8df9b1 Mon Sep 17 00:00:00 2001 From: mshwed Date: Tue, 2 Jul 2019 15:13:11 -0400 Subject: [PATCH 3/5] Added checksum calculation and helper functions --- src/core/operations/CRC8Checksum.mjs | 125 +++++++++++++++++++++------ 1 file changed, 100 insertions(+), 25 deletions(-) diff --git a/src/core/operations/CRC8Checksum.mjs b/src/core/operations/CRC8Checksum.mjs index fdcd5d1d..c25a8a2e 100644 --- a/src/core/operations/CRC8Checksum.mjs +++ b/src/core/operations/CRC8Checksum.mjs @@ -5,6 +5,9 @@ */ import Operation from "../Operation"; +import OperationError from "../errors/OperationError"; + +import { toHex } from "../lib/Hex"; /** * CRC-8 Checksum operation @@ -19,8 +22,8 @@ class CRC8Checksum extends Operation { this.name = "CRC-8 Checksum"; this.module = "Crypto"; - this.description = ""; - this.infoURL = ""; + 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.

The CRC was invented by W. Wesley Peterson in 1961."; + this.infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check"; this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ @@ -28,36 +31,97 @@ class CRC8Checksum extends Operation { "name": "Algorithm", "type": "option", "value": [ - "CRC-8" + "CRC-8", + "CRC-8/CDMA2000", + "CRC-8/DARC", + "CRC-8/DVB-S2", + "CRC-8/EBU", + "CRC-8/I-CODE", + "CRC-8/ITU", + "CRC-8/MAXIM", + "CRC-8/ROHC", + "CRC-8/WCDMA" ] } ] } - calculateCRC8(algorithmName, polynomial, initializationValue, refIn, refOut, xorOut, check) { - let initializationValue = this.reverseBits(); + /** + * Generates the pre-computed lookup table for byte division + * + * @param polynomial + */ + calculateCRC8LookupTable(polynomial) { + const crc8Table = new Uint8Array(256); - return crc; + let currentByte; + for (let i = 0; i < 256; i++) { + currentByte = i; + for (let bit = 0; bit < 8; bit++) { + if ((currentByte & 0x80) != 0) { + currentByte <<= 1; + currentByte ^= polynomial; + } else { + currentByte <<= 1; + } + } + + crc8Table[i] = currentByte; + } + + return crc8Table; } /** - * For an 8 bit initialization value reverse the bits. + * Calculates the CRC-8 Checksum from an input * - * @param input + * @param {ArrayBuffer} input + * @param {number} polynomial + * @param {number} initializationValue + * @param {boolean} inputReflection + * @param {boolean} outputReflection + * @param {number} xorOut + * @param {number} check */ - reverseBits(input) { - let reflectedBits = input.toString(2).split(''); - for (let i = 0; i < hashSize / 2; i++) { - let x = reflectedBits[i]; - reflectedBits[i] = reflectedBits[hashSize - i - 1]; - reflectedBits[hashSize - i - 1] = x; + calculateCRC8(input, polynomial, initializationValue, inputReflection, outputReflection, xorOut, check) { + const crcSize = 8; + const crcTable = this.calculateCRC8LookupTable(polynomial); + + let crc = initializationValue != 0 ? initializationValue : 0; + let currentByte, position; + + input = new Uint8Array(input); + for (let inputByte of input) { + currentByte = inputReflection ? this.reverseBits(inputByte, crcSize) : inputByte; + + position = (currentByte ^ crc ) & 255; + crc = crcTable[position]; } - return parseInt(reflectedBits.join('')); + crc = outputReflection ? this.reverseBits(crc, crcSize) : crc; + + if (xorOut != 0) crc = crc ^ xorOut; + + return toHex(new Uint8Array([crc])); } /** - * @param {byteArray} input + * Reverse the bits for a given input byte. + * + * @param {number} input + */ + reverseBits(input, hashSize) { + let reversedByte = 0; + for (let i = hashSize - 1; i >= 0; i--) { + reversedByte |= ((input & 1) << i); + input >>= 1; + } + + return reversedByte; + } + + /** + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ @@ -65,18 +129,29 @@ class CRC8Checksum extends Operation { const algorithm = args[0]; if (algorithm === "CRC-8") { - return this.calculateCRC8(algorithm, 0x7, 0x0, false, false, 0x0, 0xF4) + return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x0, 0xF4); + } else if (algorithm === "CRC-8/CDMA2000") { + return this.calculateCRC8(input, 0x9B, 0xFF, false, false, 0x0, 0xDA); + } else if (algorithm === "CRC-8/DARC") { + return this.calculateCRC8(input, 0x39, 0x0, true, true, 0x0, 0x15); + } else if (algorithm === "CRC-8/DVB-S2") { + return this.calculateCRC8(input, 0xD5, 0x0, false, false, 0x0, 0xBC); + } else if (algorithm === "CRC-8/EBU") { + return this.calculateCRC8(input, 0x1D, 0xFF, true, true, 0x0, 0x97); + } else if (algorithm === "CRC-8/I-CODE") { + return this.calculateCRC8(input, 0x1D, 0xFD, false, false, 0x0, 0x7E); + } else if (algorithm === "CRC-8/ITU") { + return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x55, 0xA1); + } else if (algorithm === "CRC-8/MAXIM") { + return this.calculateCRC8(input, 0x31, 0x0, true, true, 0x0, 0xA1); + } else if (algorithm === "CRC-8/ROHC") { + return this.calculateCRC8(input, 0x7, 0xFF, true, true, 0x0, 0xD0); + } else if (algorithm === "CRC-8/WCDMA") { + return this.calculateCRC8(input, 0x9B, 0x0, true, true, 0x0, 0x25); } - return ""; + throw new OperationError("Unknown checksum algorithm"); } - } -const hashSize = 8; - -// const CRC8AlgoParameters = { -// 'CRC8' -// } - export default CRC8Checksum; From 44643c151ad64101b8dbb77d2f32e5d8aeafce36 Mon Sep 17 00:00:00 2001 From: mshwed Date: Tue, 2 Jul 2019 15:30:59 -0400 Subject: [PATCH 4/5] Fixed linting issues and added CRC-8 tests --- src/core/operations/CRC8Checksum.mjs | 85 +++++++++--------- tests/operations/tests/Checksum.mjs | 123 ++++++++++++++++++++++++++- 2 files changed, 164 insertions(+), 44 deletions(-) diff --git a/src/core/operations/CRC8Checksum.mjs b/src/core/operations/CRC8Checksum.mjs index c25a8a2e..ec70c603 100644 --- a/src/core/operations/CRC8Checksum.mjs +++ b/src/core/operations/CRC8Checksum.mjs @@ -28,28 +28,28 @@ class CRC8Checksum extends Operation { this.outputType = "string"; this.args = [ { - "name": "Algorithm", - "type": "option", - "value": [ - "CRC-8", - "CRC-8/CDMA2000", - "CRC-8/DARC", - "CRC-8/DVB-S2", - "CRC-8/EBU", - "CRC-8/I-CODE", - "CRC-8/ITU", - "CRC-8/MAXIM", - "CRC-8/ROHC", - "CRC-8/WCDMA" - ] + "name": "Algorithm", + "type": "option", + "value": [ + "CRC-8", + "CRC-8/CDMA2000", + "CRC-8/DARC", + "CRC-8/DVB-S2", + "CRC-8/EBU", + "CRC-8/I-CODE", + "CRC-8/ITU", + "CRC-8/MAXIM", + "CRC-8/ROHC", + "CRC-8/WCDMA" + ] } - ] + ]; } /** - * Generates the pre-computed lookup table for byte division - * - * @param polynomial + * Generates the pre-computed lookup table for byte division + * + * @param polynomial */ calculateCRC8LookupTable(polynomial) { const crc8Table = new Uint8Array(256); @@ -58,7 +58,7 @@ class CRC8Checksum extends Operation { for (let i = 0; i < 256; i++) { currentByte = i; for (let bit = 0; bit < 8; bit++) { - if ((currentByte & 0x80) != 0) { + if ((currentByte & 0x80) !== 0) { currentByte <<= 1; currentByte ^= polynomial; } else { @@ -67,48 +67,47 @@ class CRC8Checksum extends Operation { } crc8Table[i] = currentByte; - } + } return crc8Table; } /** * Calculates the CRC-8 Checksum from an input - * + * * @param {ArrayBuffer} input * @param {number} polynomial * @param {number} initializationValue * @param {boolean} inputReflection * @param {boolean} outputReflection * @param {number} xorOut - * @param {number} check */ - calculateCRC8(input, polynomial, initializationValue, inputReflection, outputReflection, xorOut, check) { - const crcSize = 8; + calculateCRC8(input, polynomial, initializationValue, inputReflection, outputReflection, xorOut) { + const crcSize = 8; const crcTable = this.calculateCRC8LookupTable(polynomial); - - let crc = initializationValue != 0 ? initializationValue : 0; + + let crc = initializationValue !== 0 ? initializationValue : 0; let currentByte, position; input = new Uint8Array(input); - for (let inputByte of input) { + for (const inputByte of input) { currentByte = inputReflection ? this.reverseBits(inputByte, crcSize) : inputByte; - position = (currentByte ^ crc ) & 255; + position = (currentByte ^ crc) & 255; crc = crcTable[position]; } - crc = outputReflection ? this.reverseBits(crc, crcSize) : crc; + crc = outputReflection ? this.reverseBits(crc, crcSize) : crc; - if (xorOut != 0) crc = crc ^ xorOut; + if (xorOut !== 0) crc = crc ^ xorOut; return toHex(new Uint8Array([crc])); } /** - * Reverse the bits for a given input byte. - * - * @param {number} input + * Reverse the bits for a given input byte. + * + * @param {number} input */ reverseBits(input, hashSize) { let reversedByte = 0; @@ -129,25 +128,25 @@ class CRC8Checksum extends Operation { const algorithm = args[0]; if (algorithm === "CRC-8") { - return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x0, 0xF4); + return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x0); } else if (algorithm === "CRC-8/CDMA2000") { - return this.calculateCRC8(input, 0x9B, 0xFF, false, false, 0x0, 0xDA); + return this.calculateCRC8(input, 0x9B, 0xFF, false, false, 0x0); } else if (algorithm === "CRC-8/DARC") { - return this.calculateCRC8(input, 0x39, 0x0, true, true, 0x0, 0x15); + return this.calculateCRC8(input, 0x39, 0x0, true, true, 0x0); } else if (algorithm === "CRC-8/DVB-S2") { - return this.calculateCRC8(input, 0xD5, 0x0, false, false, 0x0, 0xBC); + return this.calculateCRC8(input, 0xD5, 0x0, false, false, 0x0); } else if (algorithm === "CRC-8/EBU") { - return this.calculateCRC8(input, 0x1D, 0xFF, true, true, 0x0, 0x97); + return this.calculateCRC8(input, 0x1D, 0xFF, true, true, 0x0); } else if (algorithm === "CRC-8/I-CODE") { - return this.calculateCRC8(input, 0x1D, 0xFD, false, false, 0x0, 0x7E); + return this.calculateCRC8(input, 0x1D, 0xFD, false, false, 0x0); } else if (algorithm === "CRC-8/ITU") { - return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x55, 0xA1); + return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x55); } else if (algorithm === "CRC-8/MAXIM") { - return this.calculateCRC8(input, 0x31, 0x0, true, true, 0x0, 0xA1); + return this.calculateCRC8(input, 0x31, 0x0, true, true, 0x0); } else if (algorithm === "CRC-8/ROHC") { - return this.calculateCRC8(input, 0x7, 0xFF, true, true, 0x0, 0xD0); + return this.calculateCRC8(input, 0x7, 0xFF, true, true, 0x0); } else if (algorithm === "CRC-8/WCDMA") { - return this.calculateCRC8(input, 0x9B, 0x0, true, true, 0x0, 0x25); + return this.calculateCRC8(input, 0x9B, 0x0, true, true, 0x0); } throw new OperationError("Unknown checksum algorithm"); diff --git a/tests/operations/tests/Checksum.mjs b/tests/operations/tests/Checksum.mjs index 9be19495..4df7783c 100644 --- a/tests/operations/tests/Checksum.mjs +++ b/tests/operations/tests/Checksum.mjs @@ -29,6 +29,127 @@ const ALL_BYTES = [ ].join(""); TestRegister.addTests([ + { + name: "CRC-8: nothing", + input: "", + expectedOutput: "00", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8"] + } + ] + }, + { + name: "CRC-8: default check", + input: "123456789", + expectedOutput: "f4", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8"] + } + ] + }, + { + name: "CRC-8: CDMA2000", + input: "123456789", + expectedOutput: "da", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/CDMA2000"] + } + ] + }, + { + name: "CRC-8: DARC", + input: "123456789", + expectedOutput: "15", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/DARC"] + } + ] + }, + { + name: "CRC-8: DVB-S2", + input: "123456789", + expectedOutput: "bc", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/DVB-S2"] + } + ] + }, + { + name: "CRC-8: EBU", + input: "123456789", + expectedOutput: "97", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/EBU"] + } + ] + }, + { + name: "CRC-8: I-CODE", + input: "123456789", + expectedOutput: "7e", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/I-CODE"] + } + ] + }, + { + name: "CRC-8: ITU", + input: "123456789", + expectedOutput: "a1", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/ITU"] + } + ] + }, + { + name: "CRC-8: MAXIM", + input: "123456789", + expectedOutput: "a1", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/MAXIM"] + } + ] + }, + { + name: "CRC-8: ROHC", + input: "123456789", + expectedOutput: "d0", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/ROHC"] + } + ] + }, + { + name: "CRC-8: WCDMA", + input: "123456789", + expectedOutput: "25", + recipeConfig: [ + { + "op": "CRC-8 Checksum", + "args": ["CRC-8/WCDMA"] + } + ] + }, { name: "CRC-16: nothing", input: "", @@ -116,5 +237,5 @@ TestRegister.addTests([ "args": [] } ] - }, + } ]); From 13b0ab73d051b109e20836241e9e18c3af906990 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Wed, 3 Jul 2019 15:07:26 +0100 Subject: [PATCH 5/5] Tidied up CRC-8 operation and added it to 'Generate all hashes' --- src/core/operations/CRC8Checksum.mjs | 49 ++++++++++++----------- src/core/operations/GenerateAllHashes.mjs | 6 ++- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/core/operations/CRC8Checksum.mjs b/src/core/operations/CRC8Checksum.mjs index ec70c603..85ede097 100644 --- a/src/core/operations/CRC8Checksum.mjs +++ b/src/core/operations/CRC8Checksum.mjs @@ -7,7 +7,7 @@ import Operation from "../Operation"; import OperationError from "../errors/OperationError"; -import { toHex } from "../lib/Hex"; +import { toHexFast } from "../lib/Hex"; /** * CRC-8 Checksum operation @@ -101,7 +101,7 @@ class CRC8Checksum extends Operation { if (xorOut !== 0) crc = crc ^ xorOut; - return toHex(new Uint8Array([crc])); + return toHexFast(new Uint8Array([crc])); } /** @@ -127,29 +127,30 @@ class CRC8Checksum extends Operation { run(input, args) { const algorithm = args[0]; - if (algorithm === "CRC-8") { - return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x0); - } else if (algorithm === "CRC-8/CDMA2000") { - return this.calculateCRC8(input, 0x9B, 0xFF, false, false, 0x0); - } else if (algorithm === "CRC-8/DARC") { - return this.calculateCRC8(input, 0x39, 0x0, true, true, 0x0); - } else if (algorithm === "CRC-8/DVB-S2") { - return this.calculateCRC8(input, 0xD5, 0x0, false, false, 0x0); - } else if (algorithm === "CRC-8/EBU") { - return this.calculateCRC8(input, 0x1D, 0xFF, true, true, 0x0); - } else if (algorithm === "CRC-8/I-CODE") { - return this.calculateCRC8(input, 0x1D, 0xFD, false, false, 0x0); - } else if (algorithm === "CRC-8/ITU") { - return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x55); - } else if (algorithm === "CRC-8/MAXIM") { - return this.calculateCRC8(input, 0x31, 0x0, true, true, 0x0); - } else if (algorithm === "CRC-8/ROHC") { - return this.calculateCRC8(input, 0x7, 0xFF, true, true, 0x0); - } else if (algorithm === "CRC-8/WCDMA") { - return this.calculateCRC8(input, 0x9B, 0x0, true, true, 0x0); + switch (algorithm) { + case "CRC-8": + return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x0); + case "CRC-8/CDMA2000": + return this.calculateCRC8(input, 0x9B, 0xFF, false, false, 0x0); + case "CRC-8/DARC": + return this.calculateCRC8(input, 0x39, 0x0, true, true, 0x0); + case "CRC-8/DVB-S2": + return this.calculateCRC8(input, 0xD5, 0x0, false, false, 0x0); + case "CRC-8/EBU": + return this.calculateCRC8(input, 0x1D, 0xFF, true, true, 0x0); + case "CRC-8/I-CODE": + return this.calculateCRC8(input, 0x1D, 0xFD, false, false, 0x0); + case "CRC-8/ITU": + return this.calculateCRC8(input, 0x7, 0x0, false, false, 0x55); + case "CRC-8/MAXIM": + return this.calculateCRC8(input, 0x31, 0x0, true, true, 0x0); + case "CRC-8/ROHC": + return this.calculateCRC8(input, 0x7, 0xFF, true, true, 0x0); + case "CRC-8/WCDMA": + return this.calculateCRC8(input, 0x9B, 0x0, true, true, 0x0); + default: + throw new OperationError("Unknown checksum algorithm"); } - - throw new OperationError("Unknown checksum algorithm"); } } diff --git a/src/core/operations/GenerateAllHashes.mjs b/src/core/operations/GenerateAllHashes.mjs index 6663d4e8..4ec172e9 100644 --- a/src/core/operations/GenerateAllHashes.mjs +++ b/src/core/operations/GenerateAllHashes.mjs @@ -26,6 +26,7 @@ import Fletcher16Checksum from "./Fletcher16Checksum"; import Fletcher32Checksum from "./Fletcher32Checksum"; import Fletcher64Checksum from "./Fletcher64Checksum"; import Adler32Checksum from "./Adler32Checksum"; +import CRC8Checksum from "./CRC8Checksum"; import CRC16Checksum from "./CRC16Checksum"; import CRC32Checksum from "./CRC32Checksum"; import BLAKE2b from "./BLAKE2b"; @@ -104,8 +105,9 @@ class GenerateAllHashes extends Operation { "\nFletcher-32: " + (new Fletcher32Checksum).run(byteArray, []) + "\nFletcher-64: " + (new Fletcher64Checksum).run(byteArray, []) + "\nAdler-32: " + (new Adler32Checksum).run(byteArray, []) + - "\nCRC-16: " + (new CRC16Checksum).run(str, []) + - "\nCRC-32: " + (new CRC32Checksum).run(str, []); + "\nCRC-8: " + (new CRC8Checksum).run(arrayBuffer, ["CRC-8"]) + + "\nCRC-16: " + (new CRC16Checksum).run(arrayBuffer, []) + + "\nCRC-32: " + (new CRC32Checksum).run(arrayBuffer, []); return output; }