mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 15:56:16 -04:00
Added signed feature to 'To Decimal'
This commit is contained in:
parent
ca47ba3c7c
commit
91fc2c28dc
3 changed files with 39 additions and 30 deletions
|
@ -30,6 +30,11 @@ class ToDecimal extends Operation {
|
|||
"name": "Delimiter",
|
||||
"type": "option",
|
||||
"value": DELIM_OPTIONS
|
||||
},
|
||||
{
|
||||
"name": "Support signed values",
|
||||
"type": "boolean",
|
||||
"value": false
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@ -40,7 +45,11 @@ class ToDecimal extends Operation {
|
|||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
const delim = Utils.charRep(args[0]);
|
||||
const delim = Utils.charRep(args[0]),
|
||||
signed = args[1];
|
||||
if (signed) {
|
||||
input = input.map(v => v > 0x7F ? v - 0xFF - 1 : v);
|
||||
}
|
||||
return input.join(delim);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue