Merge branch 'math' of https://github.com/bwhitn/CyberChef into bwhitn-math

This commit is contained in:
n1474335 2017-12-21 14:46:37 +00:00
commit c1fb6d9776
4 changed files with 351 additions and 1 deletions

View file

@ -113,7 +113,7 @@ const Categories = [
]
},
{
name: "Logical operations",
name: "Arithmetic / Logic",
ops: [
"XOR",
"XOR Brute Force",
@ -127,6 +127,13 @@ const Categories = [
"Rotate left",
"Rotate right",
"ROT13",
"Sum",
"Subtract",
"Multiply",
"Divide",
"Mean",
"Median",
"Standard Deviation",
]
},
{

View file

@ -1,3 +1,4 @@
import Arithmetic from "../operations/Arithmetic.js";
import Base from "../operations/Base.js";
import Base58 from "../operations/Base58.js";
import Base64 from "../operations/Base64.js";
@ -676,6 +677,97 @@ const OperationConfig = {
}
]
},
"Sum": {
module: "Default",
description: "Sums a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>18.5</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Subtract": {
module: "Default",
description: "Subtracts a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>1.5</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Multiply": {
module: "Default",
description: "Multiplies a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>40</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Divide": {
module: "Default",
description: "Divides a list of numbers. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>2.5</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Mean": {
module: "Default",
description: "Computes the mean (average) of a number list. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5 .5</code> becomes <code>4.75</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Median": {
module: "Default",
description: "Computes the median of a number list. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 1 .5</code> becomes <code>4.5</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"Standard Deviation": {
module: "Default",
description: "Computes the standard deviation of a number list. If an item in the string is not a number it is excluded from the list.<br><br>e.g. <code>0x0a 8 .5</code> becomes <code>4.089281382128433</code>",
inputType: "string",
outputType: "string",
args: [
{
name: "Delimiter",
type: "option",
value: Arithmetic.DELIM_OPTIONS
}
]
},
"From Hexdump": {
module: "Default",
description: "Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis.",

View file

@ -1,4 +1,5 @@
import FlowControl from "../../FlowControl.js";
import Arithmetic from "../../operations/Arithmetic.js";
import Base from "../../operations/Base.js";
import Base58 from "../../operations/Base58.js";
import Base64 from "../../operations/Base64.js";
@ -159,6 +160,13 @@ OpModules.Default = {
"Return": FlowControl.runReturn,
"Comment": FlowControl.runComment,
"PHP Deserialize": PHP.runDeserialize,
"Sum": Arithmetic.runSum,
"Subtract": Arithmetic.runSub,
"Multiply": Arithmetic.runMulti,
"Divide": Arithmetic.runDiv,
"Mean": Arithmetic.runMean,
"Median": Arithmetic.runMedian,
"Standard Deviation": Arithmetic.runStdDev,
/*