mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
The CRC Operation is implemented natively with all currently known CRC's. Old Operations (CRC8, CRC16 and CRC32) and their dependencies are removed
This commit is contained in:
parent
fcecd029c7
commit
4e62aa6e1d
7 changed files with 1988 additions and 23 deletions
|
@ -135,7 +135,6 @@
|
|||
"ieee754": "^1.2.1",
|
||||
"jimp": "^0.22.12",
|
||||
"jquery": "3.7.1",
|
||||
"js-crc": "^0.2.0",
|
||||
"js-sha3": "^0.9.3",
|
||||
"jsesc": "^3.0.2",
|
||||
"json5": "^2.2.3",
|
||||
|
|
|
@ -441,9 +441,7 @@
|
|||
"Fletcher-64 Checksum",
|
||||
"Adler-32 Checksum",
|
||||
"Luhn Checksum",
|
||||
"CRC-8 Checksum",
|
||||
"CRC-16 Checksum",
|
||||
"CRC-32 Checksum",
|
||||
"CRC Checksum",
|
||||
"TCP/IP Checksum"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -349,6 +349,7 @@ class CRCChecksum extends Operation {
|
|||
*/
|
||||
run(input, args) {
|
||||
const algorithm = args[0];
|
||||
input = new Uint8Array(input);
|
||||
|
||||
switch (algorithm) {
|
||||
case "CRC-3/GSM": return this.crc(3n, input, 0x3n, 0x0n, false, false, 0x7n);
|
||||
|
|
|
@ -27,9 +27,7 @@ import Fletcher16Checksum from "./Fletcher16Checksum.mjs";
|
|||
import Fletcher32Checksum from "./Fletcher32Checksum.mjs";
|
||||
import Fletcher64Checksum from "./Fletcher64Checksum.mjs";
|
||||
import Adler32Checksum from "./Adler32Checksum.mjs";
|
||||
import CRC8Checksum from "./CRC8Checksum.mjs";
|
||||
import CRC16Checksum from "./CRC16Checksum.mjs";
|
||||
import CRC32Checksum from "./CRC32Checksum.mjs";
|
||||
import CRCChecksum from "./CRCChecksum.mjs";
|
||||
import BLAKE2b from "./BLAKE2b.mjs";
|
||||
import BLAKE2s from "./BLAKE2s.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-64", algo: (new Fletcher64Checksum), 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-16", algo: (new CRC16Checksum), inputType: "arrayBuffer", params: []},
|
||||
{name: "CRC-32", algo: (new CRC32Checksum), inputType: "arrayBuffer", params: []}
|
||||
{name: "CRC-8", algo: (new CRCChecksum), inputType: "arrayBuffer", params: ["CRC-8"]},
|
||||
{name: "CRC-16", algo: (new CRCChecksum), inputType: "arrayBuffer", params: ["CRC-16"]},
|
||||
{name: "CRC-32", algo: (new CRCChecksum), inputType: "arrayBuffer", params: ["CRC-32"]}
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -305,16 +305,6 @@ Full hash: $2a$10$ODeP1.6fMsb.ENk2ngPUCO7qTGVPyHA9TqDVcyupyed8FjsiF65L6`;
|
|||
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", () => {
|
||||
const result = chef.CSSBeautify("header {color:black;padding:3rem;}");
|
||||
const expected = `header {
|
||||
|
|
|
@ -44,7 +44,6 @@ import "./tests/ChaCha.mjs";
|
|||
import "./tests/ChangeIPFormat.mjs";
|
||||
import "./tests/CharEnc.mjs";
|
||||
import "./tests/Charts.mjs";
|
||||
import "./tests/Checksum.mjs";
|
||||
import "./tests/Ciphers.mjs";
|
||||
import "./tests/CipherSaber2.mjs";
|
||||
import "./tests/CMAC.mjs";
|
||||
|
@ -56,6 +55,7 @@ import "./tests/ConditionalJump.mjs";
|
|||
import "./tests/ConvertCoordinateFormat.mjs";
|
||||
import "./tests/ConvertLeetSpeak.mjs";
|
||||
import "./tests/ConvertToNATOAlphabet.mjs";
|
||||
import "./tests/CRCChecksum.mjs";
|
||||
import "./tests/Crypt.mjs";
|
||||
import "./tests/CSV.mjs";
|
||||
import "./tests/DateTime.mjs";
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue