Cleaned up Base62 ops and updated CHANGELOG
This commit is contained in:
parent
22454ae842
commit
d89d79116c
@ -1,6 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master).
|
All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master).
|
||||||
|
|
||||||
|
|
||||||
|
### [8.14.0] - 2018-12-18
|
||||||
|
- 'To Base62' and 'From Base62' operations added [@tcode2k16] | [#443]
|
||||||
|
|
||||||
### [8.13.0] - 2018-12-15
|
### [8.13.0] - 2018-12-15
|
||||||
- 'A1Z26 Cipher Encode' and 'A1Z26 Cipher Decode' operations added [@jarmovanlenthe] | [#441]
|
- 'A1Z26 Cipher Encode' and 'A1Z26 Cipher Decode' operations added [@jarmovanlenthe] | [#441]
|
||||||
|
|
||||||
@ -69,6 +73,7 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[8.14.0]: https://github.com/gchq/CyberChef/releases/tag/v8.14.0
|
||||||
[8.13.0]: https://github.com/gchq/CyberChef/releases/tag/v8.13.0
|
[8.13.0]: https://github.com/gchq/CyberChef/releases/tag/v8.13.0
|
||||||
[8.12.0]: https://github.com/gchq/CyberChef/releases/tag/v8.12.0
|
[8.12.0]: https://github.com/gchq/CyberChef/releases/tag/v8.12.0
|
||||||
[8.11.0]: https://github.com/gchq/CyberChef/releases/tag/v8.11.0
|
[8.11.0]: https://github.com/gchq/CyberChef/releases/tag/v8.11.0
|
||||||
@ -101,6 +106,7 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
[@klaxon1]: https://github.com/klaxon1
|
[@klaxon1]: https://github.com/klaxon1
|
||||||
[@bwhitn]: https://github.com/bwhitn
|
[@bwhitn]: https://github.com/bwhitn
|
||||||
[@jarmovanlenthe]: https://github.com/jarmovanlenthe
|
[@jarmovanlenthe]: https://github.com/jarmovanlenthe
|
||||||
|
[@tcode2k16]: https://github.com/tcode2k16
|
||||||
|
|
||||||
[#95]: https://github.com/gchq/CyberChef/pull/299
|
[#95]: https://github.com/gchq/CyberChef/pull/299
|
||||||
[#173]: https://github.com/gchq/CyberChef/pull/173
|
[#173]: https://github.com/gchq/CyberChef/pull/173
|
||||||
@ -125,3 +131,4 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
[#394]: https://github.com/gchq/CyberChef/pull/394
|
[#394]: https://github.com/gchq/CyberChef/pull/394
|
||||||
[#428]: https://github.com/gchq/CyberChef/pull/428
|
[#428]: https://github.com/gchq/CyberChef/pull/428
|
||||||
[#441]: https://github.com/gchq/CyberChef/pull/441
|
[#441]: https://github.com/gchq/CyberChef/pull/441
|
||||||
|
[#443]: https://github.com/gchq/CyberChef/pull/443
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
"From Binary",
|
"From Binary",
|
||||||
"To Octal",
|
"To Octal",
|
||||||
"From Octal",
|
"From Octal",
|
||||||
"To Base62",
|
|
||||||
"From Base62",
|
|
||||||
"To Base64",
|
"To Base64",
|
||||||
"From Base64",
|
"From Base64",
|
||||||
"Show Base64 offsets",
|
"Show Base64 offsets",
|
||||||
@ -27,6 +25,8 @@
|
|||||||
"From Base32",
|
"From Base32",
|
||||||
"To Base58",
|
"To Base58",
|
||||||
"From Base58",
|
"From Base58",
|
||||||
|
"To Base62",
|
||||||
|
"From Base62",
|
||||||
"To Base85",
|
"To Base85",
|
||||||
"From Base85",
|
"From Base85",
|
||||||
"To Base",
|
"To Base",
|
||||||
|
@ -22,21 +22,27 @@ class FromBase62 extends Operation {
|
|||||||
|
|
||||||
this.name = "From Base62";
|
this.name = "From Base62";
|
||||||
this.module = "Default";
|
this.module = "Default";
|
||||||
this.description = "decode base62 string";
|
this.description = "Base62 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system.";
|
||||||
this.infoURL = "https://en.wikipedia.org/wiki/List_of_numeral_systems";
|
this.infoURL = "https://wikipedia.org/wiki/List_of_numeral_systems";
|
||||||
this.inputType = "string";
|
this.inputType = "string";
|
||||||
this.outputType = "string";
|
this.outputType = "byteArray";
|
||||||
this.args = [];
|
this.args = [
|
||||||
|
{
|
||||||
|
name: "Alphabet",
|
||||||
|
type: "string",
|
||||||
|
value: "0-9A-Za-z"
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} input
|
* @param {string} input
|
||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {string}
|
* @returns {byteArray}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
if (input.length < 1) return "";
|
if (input.length < 1) return [];
|
||||||
const ALPHABET = Utils.expandAlphRange("0-9A-Za-z").join("");
|
const ALPHABET = Utils.expandAlphRange(args[0]).join("");
|
||||||
const BN = BigNumber.clone({ ALPHABET });
|
const BN = BigNumber.clone({ ALPHABET });
|
||||||
|
|
||||||
const re = new RegExp("[^" + ALPHABET.replace(/[[\]\\\-^$]/g, "\\$&") + "]", "g");
|
const re = new RegExp("[^" + ALPHABET.replace(/[[\]\\\-^$]/g, "\\$&") + "]", "g");
|
||||||
@ -44,7 +50,7 @@ class FromBase62 extends Operation {
|
|||||||
|
|
||||||
const number = new BN(input, 62);
|
const number = new BN(input, 62);
|
||||||
|
|
||||||
return Utils.byteArrayToUtf8(Utils.convertToByteArray(number.toString(16), "Hex"));
|
return Utils.convertToByteArray(number.toString(16), "Hex");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,17 @@ class ToBase62 extends Operation {
|
|||||||
|
|
||||||
this.name = "To Base62";
|
this.name = "To Base62";
|
||||||
this.module = "Default";
|
this.module = "Default";
|
||||||
this.description = "encode string to base62";
|
this.description = "Base62 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. The high number base results in shorter strings than with the decimal or hexadecimal system.";
|
||||||
this.infoURL = "https://en.wikipedia.org/wiki/List_of_numeral_systems";
|
this.infoURL = "https://en.wikipedia.org/wiki/List_of_numeral_systems";
|
||||||
this.inputType = "string";
|
this.inputType = "byteArray";
|
||||||
this.outputType = "string";
|
this.outputType = "string";
|
||||||
this.args = [];
|
this.args = [
|
||||||
|
{
|
||||||
|
name: "Alphabet",
|
||||||
|
type: "string",
|
||||||
|
value: "0-9A-Za-z"
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,12 +43,10 @@ class ToBase62 extends Operation {
|
|||||||
run(input, args) {
|
run(input, args) {
|
||||||
if (input.length < 1) return "";
|
if (input.length < 1) return "";
|
||||||
|
|
||||||
const ALPHABET = Utils.expandAlphRange("0-9A-Za-z").join("");
|
const ALPHABET = Utils.expandAlphRange(args[0]).join("");
|
||||||
const BN = BigNumber.clone({ ALPHABET });
|
const BN = BigNumber.clone({ ALPHABET });
|
||||||
|
|
||||||
input = Utils.strToByteArray(input);
|
input = toHexFast(input).toUpperCase();
|
||||||
input = toHexFast(input);
|
|
||||||
input = input.toUpperCase();
|
|
||||||
|
|
||||||
const number = new BN(input, 16);
|
const number = new BN(input, 16);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "To Base62",
|
op: "To Base62",
|
||||||
args: [],
|
args: ["0-9A-Za-z"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -28,7 +28,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "To Base62",
|
op: "To Base62",
|
||||||
args: [],
|
args: ["0-9A-Za-z"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -39,7 +39,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "To Base62",
|
op: "To Base62",
|
||||||
args: [],
|
args: ["0-9A-Za-z"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -50,7 +50,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "From Base62",
|
op: "From Base62",
|
||||||
args: [],
|
args: ["0-9A-Za-z"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -61,7 +61,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "From Base62",
|
op: "From Base62",
|
||||||
args: [],
|
args: ["0-9A-Za-z"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -72,7 +72,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "From Base62",
|
op: "From Base62",
|
||||||
args: [],
|
args: ["0-9A-Za-z"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user