mirror of
https://github.com/gchq/CyberChef
synced 2026-01-06 02:23:20 +00:00
Tidied up Base85 issues
This commit is contained in:
@@ -85,6 +85,10 @@ class FromBase85 extends Operation {
|
||||
throw new OperationError("Alphabet must be of length 85");
|
||||
}
|
||||
|
||||
// Remove delimiters if present
|
||||
const matches = input.match(/^<~(.+?)~>$/);
|
||||
if (matches !== null) input = matches[1];
|
||||
|
||||
// Remove non-alphabet characters
|
||||
if (removeNonAlphChars) {
|
||||
const re = new RegExp("[^" + alphabet.replace(/[[\]\\\-^$]/g, "\\$&") + "]", "g");
|
||||
@@ -93,13 +97,6 @@ class FromBase85 extends Operation {
|
||||
|
||||
if (input.length === 0) return [];
|
||||
|
||||
input = input.replace(/\s+/g, "");
|
||||
|
||||
if (encoding === "Standard") {
|
||||
const matches = input.match(/<~(.+?)~>/);
|
||||
if (matches !== null) input = matches[1];
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
let block, blockBytes;
|
||||
while (i < input.length) {
|
||||
|
||||
Reference in New Issue
Block a user