mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Merge branch 'FromNegs' of https://github.com/qistoph/CyberChef into qistoph-FromNegs
This commit is contained in:
commit
ca47ba3c7c
3 changed files with 45 additions and 2 deletions
|
@ -29,6 +29,11 @@ class FromDecimal extends Operation {
|
|||
"name": "Delimiter",
|
||||
"type": "option",
|
||||
"value": DELIM_OPTIONS
|
||||
},
|
||||
{
|
||||
"name": "Convert negatives",
|
||||
"type": "boolean",
|
||||
"value": false
|
||||
}
|
||||
];
|
||||
this.patterns = [
|
||||
|
@ -71,7 +76,11 @@ class FromDecimal extends Operation {
|
|||
* @returns {byteArray}
|
||||
*/
|
||||
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