mirror of
https://github.com/gchq/CyberChef
synced 2025-01-09 02:58:46 +00:00
Base85: Fix alphabetName
This commit is contained in:
parent
4c3324aea1
commit
0182cdda69
1 changed files with 5 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import Utils from "../Utils.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base85 resources.
|
* Base85 resources.
|
||||||
*
|
*
|
||||||
|
@ -32,13 +34,12 @@ export const ALPHABET_OPTIONS = [
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function alphabetName(alphabet) {
|
export function alphabetName(alphabet) {
|
||||||
alphabet = alphabet.replace("'", "'");
|
alphabet = escape(alphabet);
|
||||||
alphabet = alphabet.replace("\"", """);
|
|
||||||
alphabet = alphabet.replace("\\", "\");
|
|
||||||
let name;
|
let name;
|
||||||
|
|
||||||
ALPHABET_OPTIONS.forEach(function(a) {
|
ALPHABET_OPTIONS.forEach(function(a) {
|
||||||
if (escape(alphabet) === escape(a.value)) name = a.name;
|
const expanded = Utils.expandAlphRange(a.value).join("");
|
||||||
|
if (alphabet === escape(expanded)) name = a.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|
Loading…
Reference in a new issue