From 550ab403f632458d15312ecd10d8c8f74b752f46 Mon Sep 17 00:00:00 2001 From: mshwed Date: Sun, 30 Jun 2019 21:28:00 -0400 Subject: [PATCH] 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;