mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Enable parsing of negative decimals #176
This commit is contained in:
parent
d6c6981bc0
commit
a276378887
1 changed files with 10 additions and 1 deletions
|
@ -29,6 +29,11 @@ class FromDecimal extends Operation {
|
||||||
"name": "Delimiter",
|
"name": "Delimiter",
|
||||||
"type": "option",
|
"type": "option",
|
||||||
"value": DELIM_OPTIONS
|
"value": DELIM_OPTIONS
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Convert negatives",
|
||||||
|
"type": "boolean",
|
||||||
|
"value": false
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
this.patterns = [
|
this.patterns = [
|
||||||
|
@ -71,7 +76,11 @@ class FromDecimal extends Operation {
|
||||||
* @returns {byteArray}
|
* @returns {byteArray}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
return fromDecimal(input, args[0]);
|
let data = fromDecimal(input, args[0]);
|
||||||
|
if (args[1]) { // Convert negatives
|
||||||
|
data = data.map(v => v < 0 ? 0xFF + v + 1 : v);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue