mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 14:11:02 +01:00
Ported the TCPIPChecksum operation.
Main content has been moved to the IP lib file, as it is used in multiple files. Changed the name, due to it originally containing a backslash, which caused issues with the script.
This commit is contained in:
parent
1920e9c7fb
commit
161f89c038
40
src/core/operations/TCPIPChecksum.mjs
Normal file
40
src/core/operations/TCPIPChecksum.mjs
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
import {calculateTCPIPChecksum} from "../lib/Ip";
|
||||
|
||||
/**
|
||||
* TCP/IP Checksum operation
|
||||
*/
|
||||
class TCPIPChecksum extends Operation {
|
||||
|
||||
/**
|
||||
* TCP/IPChecksum constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "TCP/IP Checksum";
|
||||
this.module = "Hashing";
|
||||
this.description = "Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.";
|
||||
this.inputType = "byteArray";
|
||||
this.outputType = "string";
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {byteArray} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
return calculateTCPIPChecksum(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default TCPIPChecksum;
|
Loading…
Reference in New Issue
Block a user