diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index e90ab51f..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/.github/ISSUE_TEMPLATE/operation-request.md b/.github/ISSUE_TEMPLATE/operation-request.md index d88e6703..05231a86 100644 --- a/.github/ISSUE_TEMPLATE/operation-request.md +++ b/.github/ISSUE_TEMPLATE/operation-request.md @@ -7,8 +7,14 @@ assignees: '' --- -## Summary +**Is your operation request related to a problem? Please describe.** +A clear and concise description of what the problem is. E.g. I'm always frustrated when [...] -### Example Input +**Describe the solution you'd like** +A clear and concise description of the new operation you would like. -### Example Output +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Example input and output** +Provide an example input to the operation, along with the output that you would expect. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..8d6cc970 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +**Description** +Provide a description of the pull request and the changes that it makes. + +**Existing Issue** +If this pull request relates to an existing issue in the repository, please link it here. + +**Screenshots** +If the pull request changes any visual aspects of CyberChef, please include screenshots. + +**AI disclosure** +If you have used any AI tools while creating this code, **you must declare your usage along with the name of the tools that you used**. +Regardless of AI tool usage, you are responsible for any code that you submit, and we expect you to have checked the code and have enough of an understanding of it to answer any questions we might have. + +**Test Coverage** +Please ensure you have added test coverage for your changes. diff --git a/.github/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 100% rename from .github/CONTRIBUTING.md rename to CONTRIBUTING.md diff --git a/src/core/lib/Modhex.mjs b/src/core/lib/Modhex.mjs index 4f28e9a1..ab4a7c8b 100644 --- a/src/core/lib/Modhex.mjs +++ b/src/core/lib/Modhex.mjs @@ -50,6 +50,7 @@ const HEX_ALPHABET_MAP = HEX_ALPHABET.split(""); export function toModhex(data, delim=" ", padding=2, extraDelim="", lineSize=0) { if (!data) return ""; if (data instanceof ArrayBuffer) data = new Uint8Array(data); + if (data.length === 0) return ""; const regularHexString = toHex(data, "", padding, "", 0); @@ -100,6 +101,7 @@ export function toModhex(data, delim=" ", padding=2, extraDelim="", lineSize=0) export function toModhexFast(data) { if (!data) return ""; if (data instanceof ArrayBuffer) data = new Uint8Array(data); + if (data.length === 0) return ""; const output = []; diff --git a/tests/operations/tests/Modhex.mjs b/tests/operations/tests/Modhex.mjs index 1e0f2791..07f38910 100644 --- a/tests/operations/tests/Modhex.mjs +++ b/tests/operations/tests/Modhex.mjs @@ -147,4 +147,24 @@ dc;ii;hv;ig;hr;hf;dc;he;hj;hv;hv;ie;hg;du", } ] }, + { + name: "Empty input through From Hex and To Modhex returns empty output", + input: "", + expectedOutput: "", + recipeConfig: [ + { + "op": "From Hex", + "args": [ + "Auto" + ] + }, + { + "op": "To Modhex", + "args": [ + "Space", + 0 + ] + } + ] + }, ]);