mirror of
https://github.com/gchq/CyberChef
synced 2026-01-08 03:23:34 +00:00
Added 'Decimal' option for toggleStrings. Closes #337.
This commit is contained in:
@@ -29,7 +29,7 @@ class ADD extends Operation {
|
||||
"name": "Key",
|
||||
"type": "toggleString",
|
||||
"value": "",
|
||||
"toggleValues": ["Hex", "Base64", "UTF8", "Latin1"]
|
||||
"toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class AND extends Operation {
|
||||
"name": "Key",
|
||||
"type": "toggleString",
|
||||
"value": "",
|
||||
"toggleValues": ["Hex", "Base64", "UTF8", "Latin1"]
|
||||
"toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
import Utils from "../Utils";
|
||||
import {DELIM_OPTIONS} from "../lib/Delim";
|
||||
import {fromDecimal} from "../lib/Decimal";
|
||||
|
||||
/**
|
||||
* From Decimal operation
|
||||
@@ -71,16 +71,7 @@ class FromDecimal extends Operation {
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
run(input, args) {
|
||||
const delim = Utils.charRep(args[0]),
|
||||
output = [];
|
||||
let byteStr = input.split(delim);
|
||||
if (byteStr[byteStr.length-1] === "")
|
||||
byteStr = byteStr.slice(0, byteStr.length-1);
|
||||
|
||||
for (let i = 0; i < byteStr.length; i++) {
|
||||
output[i] = parseInt(byteStr[i], 10);
|
||||
}
|
||||
return output;
|
||||
return fromDecimal(input, args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class FromHex extends Operation {
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
run(input, args) {
|
||||
const delim = args[0] || "Space";
|
||||
const delim = args[0] || "Auto";
|
||||
return fromHex(input, delim, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class OR extends Operation {
|
||||
"name": "Key",
|
||||
"type": "toggleString",
|
||||
"value": "",
|
||||
"toggleValues": ["Hex", "Base64", "UTF8", "Latin1"]
|
||||
"toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class SUB extends Operation {
|
||||
"name": "Key",
|
||||
"type": "toggleString",
|
||||
"value": "",
|
||||
"toggleValues": ["Hex", "Base64", "UTF8", "Latin1"]
|
||||
"toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class XOR extends Operation {
|
||||
"name": "Key",
|
||||
"type": "toggleString",
|
||||
"value": "",
|
||||
"toggleValues": ["Hex", "Base64", "UTF8", "Latin1"]
|
||||
"toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"]
|
||||
},
|
||||
{
|
||||
"name": "Scheme",
|
||||
|
||||
Reference in New Issue
Block a user