mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Added 'Decimal' option for toggleStrings. Closes #337.
This commit is contained in:
parent
c1b2fc9400
commit
affe057cab
10 changed files with 51 additions and 21 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue