mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 00:06:17 -04:00
Merge branch 'master' into master
This commit is contained in:
commit
bbb211d819
12 changed files with 3173 additions and 504 deletions
|
@ -136,7 +136,6 @@
|
||||||
"jimp": "^0.22.12",
|
"jimp": "^0.22.12",
|
||||||
"jq-web": "^0.5.1",
|
"jq-web": "^0.5.1",
|
||||||
"jquery": "3.7.1",
|
"jquery": "3.7.1",
|
||||||
"js-crc": "^0.2.0",
|
|
||||||
"js-sha3": "^0.9.3",
|
"js-sha3": "^0.9.3",
|
||||||
"jsesc": "^3.0.2",
|
"jsesc": "^3.0.2",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
|
|
|
@ -445,9 +445,7 @@
|
||||||
"Fletcher-64 Checksum",
|
"Fletcher-64 Checksum",
|
||||||
"Adler-32 Checksum",
|
"Adler-32 Checksum",
|
||||||
"Luhn Checksum",
|
"Luhn Checksum",
|
||||||
"CRC-8 Checksum",
|
"CRC Checksum",
|
||||||
"CRC-16 Checksum",
|
|
||||||
"CRC-32 Checksum",
|
|
||||||
"TCP/IP Checksum"
|
"TCP/IP Checksum"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
/**
|
|
||||||
* @author n1474335 [n1474335@gmail.com]
|
|
||||||
* @copyright Crown Copyright 2016
|
|
||||||
* @license Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
|
||||||
import JSCRC from "js-crc";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRC-16 Checksum operation
|
|
||||||
*/
|
|
||||||
class CRC16Checksum extends Operation {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRC16Checksum constructor
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.name = "CRC-16 Checksum";
|
|
||||||
this.module = "Crypto";
|
|
||||||
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.";
|
|
||||||
this.infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check";
|
|
||||||
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;
|
|
|
@ -1,41 +0,0 @@
|
||||||
/**
|
|
||||||
* @author n1474335 [n1474335@gmail.com]
|
|
||||||
* @copyright Crown Copyright 2016
|
|
||||||
* @license Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
|
||||||
import JSCRC from "js-crc";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRC-32 Checksum operation
|
|
||||||
*/
|
|
||||||
class CRC32Checksum extends Operation {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRC32Checksum constructor
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.name = "CRC-32 Checksum";
|
|
||||||
this.module = "Crypto";
|
|
||||||
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; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.";
|
|
||||||
this.infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check";
|
|
||||||
this.inputType = "ArrayBuffer";
|
|
||||||
this.outputType = "string";
|
|
||||||
this.args = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {ArrayBuffer} input
|
|
||||||
* @param {Object[]} args
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
run(input, args) {
|
|
||||||
return JSCRC.crc32(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default CRC32Checksum;
|
|
|
@ -1,157 +0,0 @@
|
||||||
/**
|
|
||||||
* @author mshwed [m@ttshwed.com]
|
|
||||||
* @copyright Crown Copyright 2019
|
|
||||||
* @license Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
|
||||||
import OperationError from "../errors/OperationError.mjs";
|
|
||||||
|
|
||||||
import { toHexFast } from "../lib/Hex.mjs";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRC-8 Checksum operation
|
|
||||||
*/
|
|
||||||
class CRC8Checksum extends Operation {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRC8Checksum constructor
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.name = "CRC-8 Checksum";
|
|
||||||
this.module = "Crypto";
|
|
||||||
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.";
|
|
||||||
this.infoURL = "https://wikipedia.org/wiki/Cyclic_redundancy_check";
|
|
||||||
this.inputType = "ArrayBuffer";
|
|
||||||
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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates the pre-computed lookup table for byte division
|
|
||||||
*
|
|
||||||
* @param polynomial
|
|
||||||
*/
|
|
||||||
calculateCRC8LookupTable(polynomial) {
|
|
||||||
const crc8Table = new Uint8Array(256);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
calculateCRC8(input, polynomial, initializationValue, inputReflection, outputReflection, xorOut) {
|
|
||||||
const crcSize = 8;
|
|
||||||
const crcTable = this.calculateCRC8LookupTable(polynomial);
|
|
||||||
|
|
||||||
let crc = initializationValue !== 0 ? initializationValue : 0;
|
|
||||||
let currentByte, position;
|
|
||||||
|
|
||||||
input = new Uint8Array(input);
|
|
||||||
for (const inputByte of input) {
|
|
||||||
currentByte = inputReflection ? this.reverseBits(inputByte, crcSize) : inputByte;
|
|
||||||
|
|
||||||
position = (currentByte ^ crc) & 255;
|
|
||||||
crc = crcTable[position];
|
|
||||||
}
|
|
||||||
|
|
||||||
crc = outputReflection ? this.reverseBits(crc, crcSize) : crc;
|
|
||||||
|
|
||||||
if (xorOut !== 0) crc = crc ^ xorOut;
|
|
||||||
|
|
||||||
return toHexFast(new Uint8Array([crc]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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}
|
|
||||||
*/
|
|
||||||
run(input, args) {
|
|
||||||
const algorithm = args[0];
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default CRC8Checksum;
|
|
1110
src/core/operations/CRCChecksum.mjs
Normal file
1110
src/core/operations/CRCChecksum.mjs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -27,9 +27,7 @@ import Fletcher16Checksum from "./Fletcher16Checksum.mjs";
|
||||||
import Fletcher32Checksum from "./Fletcher32Checksum.mjs";
|
import Fletcher32Checksum from "./Fletcher32Checksum.mjs";
|
||||||
import Fletcher64Checksum from "./Fletcher64Checksum.mjs";
|
import Fletcher64Checksum from "./Fletcher64Checksum.mjs";
|
||||||
import Adler32Checksum from "./Adler32Checksum.mjs";
|
import Adler32Checksum from "./Adler32Checksum.mjs";
|
||||||
import CRC8Checksum from "./CRC8Checksum.mjs";
|
import CRCChecksum from "./CRCChecksum.mjs";
|
||||||
import CRC16Checksum from "./CRC16Checksum.mjs";
|
|
||||||
import CRC32Checksum from "./CRC32Checksum.mjs";
|
|
||||||
import BLAKE2b from "./BLAKE2b.mjs";
|
import BLAKE2b from "./BLAKE2b.mjs";
|
||||||
import BLAKE2s from "./BLAKE2s.mjs";
|
import BLAKE2s from "./BLAKE2s.mjs";
|
||||||
import Streebog from "./Streebog.mjs";
|
import Streebog from "./Streebog.mjs";
|
||||||
|
@ -120,9 +118,9 @@ class GenerateAllHashes extends Operation {
|
||||||
{name: "Fletcher-32", algo: (new Fletcher32Checksum), inputType: "byteArray", params: []},
|
{name: "Fletcher-32", algo: (new Fletcher32Checksum), inputType: "byteArray", params: []},
|
||||||
{name: "Fletcher-64", algo: (new Fletcher64Checksum), inputType: "byteArray", params: []},
|
{name: "Fletcher-64", algo: (new Fletcher64Checksum), inputType: "byteArray", params: []},
|
||||||
{name: "Adler-32", algo: (new Adler32Checksum), inputType: "byteArray", params: []},
|
{name: "Adler-32", algo: (new Adler32Checksum), inputType: "byteArray", params: []},
|
||||||
{name: "CRC-8", algo: (new CRC8Checksum), inputType: "arrayBuffer", params: ["CRC-8"]},
|
{name: "CRC-8", algo: (new CRCChecksum), inputType: "arrayBuffer", params: ["CRC-8"]},
|
||||||
{name: "CRC-16", algo: (new CRC16Checksum), inputType: "arrayBuffer", params: []},
|
{name: "CRC-16", algo: (new CRCChecksum), inputType: "arrayBuffer", params: ["CRC-16"]},
|
||||||
{name: "CRC-32", algo: (new CRC32Checksum), inputType: "arrayBuffer", params: []}
|
{name: "CRC-32", algo: (new CRCChecksum), inputType: "arrayBuffer", params: ["CRC-32"]}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,9 @@ module.exports = {
|
||||||
testOp(browser, ["From Hex", "Bzip2 Decompress"], "425a68393141592653597b0884b7000003038000008200ce00200021a647a4218013709517c5dc914e14241ec2212dc0", "test_output", [[], [true]]);
|
testOp(browser, ["From Hex", "Bzip2 Decompress"], "425a68393141592653597b0884b7000003038000008200ce00200021a647a4218013709517c5dc914e14241ec2212dc0", "test_output", [[], [true]]);
|
||||||
// testOp(browser, "CBOR Decode", "test input", "test output");
|
// testOp(browser, "CBOR Decode", "test input", "test output");
|
||||||
// testOp(browser, "CBOR Encode", "test input", "test output");
|
// testOp(browser, "CBOR Encode", "test input", "test output");
|
||||||
testOp(browser, "CRC-16 Checksum", "test input", "77c7");
|
testOp(browser, "CRC Checksum", "test input", "77c7", ["CRC-16"]);
|
||||||
testOp(browser, "CRC-32 Checksum", "test input", "29822bc8");
|
testOp(browser, "CRC Checksum", "test input", "29822bc8", ["CRC-32"]);
|
||||||
testOp(browser, "CRC-8 Checksum", "test input", "9d");
|
testOp(browser, "CRC Checksum", "test input", "9d", ["CRC-8"]);
|
||||||
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
||||||
// testOp(browser, "CSS Minify", "test input", "test_output");
|
// testOp(browser, "CSS Minify", "test input", "test_output");
|
||||||
// testOp(browser, "CSS selector", "test input", "test_output");
|
// testOp(browser, "CSS selector", "test input", "test_output");
|
||||||
|
|
|
@ -305,16 +305,6 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
|
||||||
assert.strictEqual(result.toString(), "2");
|
assert.strictEqual(result.toString(), "2");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("CRC16 Checksum", () => {
|
|
||||||
const result = chef.CRC16Checksum("Rain on Your Parade");
|
|
||||||
assert.strictEqual(result.toString(), "db1c");
|
|
||||||
}),
|
|
||||||
|
|
||||||
it("CRC32 Checksum", () => {
|
|
||||||
const result = chef.CRC32Checksum("Rain on Your Parade");
|
|
||||||
assert.strictEqual(result.toString(), "e902f76c");
|
|
||||||
}),
|
|
||||||
|
|
||||||
it("CSS Beautify", () => {
|
it("CSS Beautify", () => {
|
||||||
const result = chef.CSSBeautify("header {color:black;padding:3rem;}");
|
const result = chef.CSSBeautify("header {color:black;padding:3rem;}");
|
||||||
const expected = `header {
|
const expected = `header {
|
||||||
|
|
|
@ -44,7 +44,6 @@ import "./tests/ChaCha.mjs";
|
||||||
import "./tests/ChangeIPFormat.mjs";
|
import "./tests/ChangeIPFormat.mjs";
|
||||||
import "./tests/CharEnc.mjs";
|
import "./tests/CharEnc.mjs";
|
||||||
import "./tests/Charts.mjs";
|
import "./tests/Charts.mjs";
|
||||||
import "./tests/Checksum.mjs";
|
|
||||||
import "./tests/Ciphers.mjs";
|
import "./tests/Ciphers.mjs";
|
||||||
import "./tests/CipherSaber2.mjs";
|
import "./tests/CipherSaber2.mjs";
|
||||||
import "./tests/CMAC.mjs";
|
import "./tests/CMAC.mjs";
|
||||||
|
@ -56,6 +55,7 @@ import "./tests/ConditionalJump.mjs";
|
||||||
import "./tests/ConvertCoordinateFormat.mjs";
|
import "./tests/ConvertCoordinateFormat.mjs";
|
||||||
import "./tests/ConvertLeetSpeak.mjs";
|
import "./tests/ConvertLeetSpeak.mjs";
|
||||||
import "./tests/ConvertToNATOAlphabet.mjs";
|
import "./tests/ConvertToNATOAlphabet.mjs";
|
||||||
|
import "./tests/CRCChecksum.mjs";
|
||||||
import "./tests/Crypt.mjs";
|
import "./tests/Crypt.mjs";
|
||||||
import "./tests/CSV.mjs";
|
import "./tests/CSV.mjs";
|
||||||
import "./tests/DateTime.mjs";
|
import "./tests/DateTime.mjs";
|
||||||
|
|
2054
tests/operations/tests/CRCChecksum.mjs
Normal file
2054
tests/operations/tests/CRCChecksum.mjs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,241 +0,0 @@
|
||||||
/**
|
|
||||||
* Checksum tests.
|
|
||||||
*
|
|
||||||
* @author n1474335 [n1474335@gmail.com]
|
|
||||||
* @copyright Crown Copyright 2018
|
|
||||||
* @license Apache-2.0
|
|
||||||
*/
|
|
||||||
import TestRegister from "../../lib/TestRegister.mjs";
|
|
||||||
|
|
||||||
const BASIC_STRING = "The ships hung in the sky in much the same way that bricks don't.";
|
|
||||||
const UTF8_STR = "ნუ პანიკას";
|
|
||||||
const ALL_BYTES = [
|
|
||||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
|
||||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
|
||||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
|
||||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
|
||||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
|
||||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
|
||||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
|
||||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
|
||||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
|
||||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
|
||||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
|
||||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
|
||||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
|
||||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
|
||||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
|
||||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
|
||||||
].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: "",
|
|
||||||
expectedOutput: "0000",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-16 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-16: basic string",
|
|
||||||
input: BASIC_STRING,
|
|
||||||
expectedOutput: "0c70",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-16 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-16: UTF-8",
|
|
||||||
input: UTF8_STR,
|
|
||||||
expectedOutput: "dcf6",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-16 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-16: all bytes",
|
|
||||||
input: ALL_BYTES,
|
|
||||||
expectedOutput: "bad3",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-16 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-32: nothing",
|
|
||||||
input: "",
|
|
||||||
expectedOutput: "00000000",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-32 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-32: basic string",
|
|
||||||
input: BASIC_STRING,
|
|
||||||
expectedOutput: "bf4b739c",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-32 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-32: UTF-8",
|
|
||||||
input: UTF8_STR,
|
|
||||||
expectedOutput: "87553290",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-32 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "CRC-32: all bytes",
|
|
||||||
input: ALL_BYTES,
|
|
||||||
expectedOutput: "29058c73",
|
|
||||||
recipeConfig: [
|
|
||||||
{
|
|
||||||
"op": "CRC-32 Checksum",
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
Loading…
Add table
Add a link
Reference in a new issue