Skip to content

Fixed Percent delimiter for hex encoding#2137

Merged
C85297 merged 3 commits intogchq:masterfrom
beneri:master
Feb 11, 2026
Merged

Fixed Percent delimiter for hex encoding#2137
C85297 merged 3 commits intogchq:masterfrom
beneri:master

Conversation

@beneri
Copy link
Contributor

@beneri beneri commented Nov 8, 2025

Related to issue #464

Percent (%) should be prepended, similar to "\x" and "0x".

@C85297
Copy link
Member

C85297 commented Feb 10, 2026

Issue replicated: https://gchq.github.io/CyberChef/#recipe=To_Hex('Percent',0)&input=YWJjZGVmZw
Output is: 61%62%63%64%65%66%67
Should be: %61%62%63%64%65%66%67

Copy link
Member

@C85297 C85297 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me @beneri , however it would benefit from some tests. Would you be able to create a test file tests/operations/tests/ToHex.mjs (you can use any of the other files in that directory as a template) to check that ToHex correctly performs the new behaviour as expected?

@beneri
Copy link
Contributor Author

beneri commented Feb 10, 2026

Good point about tests! I've added a new test for the percent delimiter.
There were already some tests for ToHex in Hex.mjs, I assume it is fine to put it there. Let me know otherwise.

@C85297 C85297 merged commit 324a235 into gchq:master Feb 11, 2026
2 checks passed
@C85297
Copy link
Member

C85297 commented Feb 11, 2026

Thank you for your contribution @beneri !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants