ESM: Added Hex ops and created a Hex library.

This commit is contained in:
n1474335 2018-04-02 18:06:48 +01:00
parent 0011e9caa8
commit eeb1d0a891
18 changed files with 391 additions and 196 deletions

View file

@ -27,8 +27,8 @@ const Categories = [
ops: [
// "To Hexdump",
// "From Hexdump",
// "To Hex",
// "From Hex",
"To Hex",
"From Hex",
// "To Charcode",
// "From Charcode",
// "To Decimal",

View file

@ -90,6 +90,30 @@
}
]
},
"From Hex": {
"module": "Default",
"description": "Converts a hexadecimal byte string back into its raw value.<br><br>e.g. <code>ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a</code> becomes the UTF-8 encoded string <code>Γειά σου</code>",
"inputType": "string",
"outputType": "byteArray",
"flowControl": false,
"args": [
{
"name": "Delimiter",
"type": "option",
"value": [
"Space",
"Comma",
"Semi-colon",
"Colon",
"Line feed",
"CRLF",
"0x",
"\\x",
"None"
]
}
]
},
"Show Base64 offsets": {
"module": "Default",
"description": "When a string is within a block of data and the whole block is Base64'd, the string itself could be represented in Base64 in three distinct ways depending on its offset within the block.<br><br>This operation shows all possible offsets for a given string so that each possible encoding can be considered.",
@ -189,5 +213,29 @@
]
}
]
},
"To Hex": {
"module": "Default",
"description": "Converts the input string to hexadecimal bytes separated by the specified delimiter.<br><br>e.g. The UTF-8 encoded string <code>Γειά σου</code> becomes <code>ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a</code>",
"inputType": "ArrayBuffer",
"outputType": "string",
"flowControl": false,
"args": [
{
"name": "Delimiter",
"type": "option",
"value": [
"Space",
"Comma",
"Semi-colon",
"Colon",
"Line feed",
"CRLF",
"0x",
"\\x",
"None"
]
}
]
}
}

View file

@ -7,18 +7,22 @@
*/
import FromBase32 from "../../operations/FromBase32";
import FromBase64 from "../../operations/FromBase64";
import FromHex from "../../operations/FromHex";
import ShowBase64Offsets from "../../operations/ShowBase64Offsets";
import ToBase32 from "../../operations/ToBase32";
import ToBase64 from "../../operations/ToBase64";
import ToHex from "../../operations/ToHex";
const OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
OpModules.Default = {
"From Base32": FromBase32,
"From Base64": FromBase64,
"From Hex": FromHex,
"Show Base64 offsets": ShowBase64Offsets,
"To Base32": ToBase32,
"To Base64": ToBase64,
"To Hex": ToHex,
};
export default OpModules;