diff --git a/src/core/lib/Base85.mjs b/src/core/lib/Base85.mjs
index f7d667cc..69140d03 100644
--- a/src/core/lib/Base85.mjs
+++ b/src/core/lib/Base85.mjs
@@ -12,15 +12,15 @@
export const ALPHABET_OPTIONS = [
{
name: "Standard",
- value: "!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu",
+ value: "!-u",
},
{
name: "Z85 (ZeroMQ)",
- value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#",
+ value: "0-9a-zA-Z.#\\-:+=^!/*?&<>()[]{}@%$#",
},
{
name: "IPv6",
- value: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|~}",
+ value: "0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|~}",
}
];
diff --git a/src/core/operations/FromBase85.mjs b/src/core/operations/FromBase85.mjs
index fd8c3466..2fec8e2e 100644
--- a/src/core/operations/FromBase85.mjs
+++ b/src/core/operations/FromBase85.mjs
@@ -6,6 +6,7 @@
import Operation from "../Operation";
import OperationError from "../errors/OperationError";
+import Utils from "../Utils";
import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85";
/**
@@ -21,7 +22,7 @@ class FromBase85 extends Operation {
this.name = "From Base85";
this.module = "Default";
- this.description = "Base85 (similar to Base64) is a notation for encoding arbitrary byte data. It is usually more efficient that Base64.
This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included).
e.g. BOu!rD]j7BEbo7
becomes hello world
Base85 is commonly used in Adobe's PostScript and PDF file formats.";
+ this.description = "Base85 (also called Ascii85) is a notation for encoding arbitrary byte data. It is usually more efficient that Base64.
This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included).
e.g. BOu!rD]j7BEbo7
becomes hello world
Base85 is commonly used in Adobe's PostScript and PDF file formats.";
this.infoURL = "https://wikipedia.org/wiki/Ascii85";
this.inputType = "string";
this.outputType = "byteArray";
@@ -40,7 +41,7 @@ class FromBase85 extends Operation {
* @returns {byteArray}
*/
run(input, args) {
- const alphabet = args[0] || ALPHABET_OPTIONS[0].value,
+ const alphabet = Utils.expandAlphRange(args[0]).join(""),
encoding = alphabetName(alphabet),
result = [];
@@ -68,7 +69,7 @@ class FromBase85 extends Operation {
.map((chr, idx) => {
const digit = alphabet.indexOf(chr);
if (digit < 0 || digit > 84) {
- throw "Invalid character '" + chr + "' at index " + idx;
+ throw `Invalid character '${chr}' at index ${idx}`;
}
return digit;
});
diff --git a/src/core/operations/ToBase85.mjs b/src/core/operations/ToBase85.mjs
index 3179c6a3..97cc2e72 100644
--- a/src/core/operations/ToBase85.mjs
+++ b/src/core/operations/ToBase85.mjs
@@ -6,6 +6,7 @@
import Operation from "../Operation";
import OperationError from "../errors/OperationError";
+import Utils from "../Utils";
import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85";
/**
@@ -21,7 +22,7 @@ class ToBase85 extends Operation {
this.name = "To Base85";
this.module = "Default";
- this.description = "Base85 (similar to Base64) is a notation for encoding arbitrary byte data. It is usually more efficient that Base64.
This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).
e.g. hello world
becomes BOu!rD]j7BEbo7
Base85 is commonly used in Adobe's PostScript and PDF file formats.
Options
Alphabet
hello world
becomes BOu!rD]j7BEbo7