mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Ported Bitwise operations
also enabled bitshift tests
This commit is contained in:
parent
9ffab374db
commit
95f81ad740
9 changed files with 707 additions and 1 deletions
66
src/core/operations/NOT.mjs
Normal file
66
src/core/operations/NOT.mjs
Normal file
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
import { bitOp, not } from "../lib/BitwiseOp";
|
||||
|
||||
/**
|
||||
* NOT operation
|
||||
*/
|
||||
class NOT extends Operation {
|
||||
|
||||
/**
|
||||
* NOT constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "NOT";
|
||||
this.module = "Default";
|
||||
this.description = "Returns the inverse of each byte.";
|
||||
this.inputType = "byteArray";
|
||||
this.outputType = "byteArray";
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {byteArray} input
|
||||
* @param {Object[]} args
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
run(input, args) {
|
||||
return bitOp(input, null, not);
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight NOT
|
||||
*
|
||||
* @param {Object[]} pos
|
||||
* @param {number} pos[].start
|
||||
* @param {number} pos[].end
|
||||
* @param {Object[]} args
|
||||
* @returns {Object[]} pos
|
||||
*/
|
||||
highlight(pos, args) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight NOT in reverse
|
||||
*
|
||||
* @param {Object[]} pos
|
||||
* @param {number} pos[].start
|
||||
* @param {number} pos[].end
|
||||
* @param {Object[]} args
|
||||
* @returns {Object[]} pos
|
||||
*/
|
||||
highlightReverse(pos, args) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default NOT;
|
Loading…
Add table
Add a link
Reference in a new issue