From ff63ec97b75706b7e12442c7c814e96c89f2db55 Mon Sep 17 00:00:00 2001 From: Sascha Buehrle <47737812+saschabuehrle@users.noreply.github.com> Date: Mon, 23 Mar 2026 13:26:09 +0100 Subject: [PATCH 1/2] fix: return empty output for zero-length To Modhex input (#2249) --- src/core/lib/Modhex.mjs | 2 ++ tests/operations/tests/Modhex.mjs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) 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 + ] + } + ] + }, ]); From b0fa1f8d1bebc855d6b38552e86e19115ee1e33f Mon Sep 17 00:00:00 2001 From: GCHQ Developer 85297 <95289555+C85297@users.noreply.github.com> Date: Mon, 23 Mar 2026 14:01:42 +0000 Subject: [PATCH 2/2] Add pull request template with AI usage disclosure (#2279) --- .github/ISSUE_TEMPLATE.md | 1 - .github/ISSUE_TEMPLATE/operation-request.md | 12 +++++++++--- .github/pull_request_template.md | 15 +++++++++++++++ .github/CONTRIBUTING.md => CONTRIBUTING.md | 0 4 files changed, 24 insertions(+), 4 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/pull_request_template.md rename .github/CONTRIBUTING.md => CONTRIBUTING.md (100%) 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