mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-13 09:36:52 -04:00
feat(Modhex): Introduce basic Modhex conversion
Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris@asenkron.com.tr>
This commit is contained in:
parent
c9d9730726
commit
758ff9b604
6 changed files with 444 additions and 0 deletions
65
src/core/lib/Modhex.mjs
Normal file
65
src/core/lib/Modhex.mjs
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* Modhex helpers.
|
||||
*
|
||||
* @author linuxgemini [ilteris@asenkron.com.tr]
|
||||
* @copyright Crown Copyright 2020
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Modhex to Hex conversion map.
|
||||
*/
|
||||
export const MODHEX_TO_HEX_CONVERSION_MAP = {
|
||||
"c": "0",
|
||||
"b": "1",
|
||||
"d": "2",
|
||||
"e": "3",
|
||||
"f": "4",
|
||||
"g": "5",
|
||||
"h": "6",
|
||||
"i": "7",
|
||||
"j": "8",
|
||||
"k": "9",
|
||||
"l": "a",
|
||||
"n": "b",
|
||||
"r": "c",
|
||||
"t": "d",
|
||||
"u": "e",
|
||||
"v": "f"
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Hex to Modhex conversion map.
|
||||
*/
|
||||
export const HEX_TO_MODHEX_CONVERSION_MAP = {
|
||||
"0": "c",
|
||||
"1": "b",
|
||||
"2": "d",
|
||||
"3": "e",
|
||||
"4": "f",
|
||||
"5": "g",
|
||||
"6": "h",
|
||||
"7": "i",
|
||||
"8": "j",
|
||||
"9": "k",
|
||||
"a": "l",
|
||||
"b": "n",
|
||||
"c": "r",
|
||||
"d": "t",
|
||||
"e": "u",
|
||||
"f": "v"
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* To Modhex delimiters.
|
||||
*/
|
||||
export const TO_MODHEX_DELIM_OPTIONS = ["Space", "Percent", "Comma", "Semi-colon", "Colon", "Line feed", "CRLF", "None"];
|
||||
|
||||
|
||||
/**
|
||||
* From Modhex delimiters.
|
||||
*/
|
||||
export const FROM_MODHEX_DELIM_OPTIONS = ["Auto"].concat(TO_MODHEX_DELIM_OPTIONS);
|
Loading…
Add table
Add a link
Reference in a new issue