Add base65536 and hexagram encoding injection probes#1843
Open
assinscreedFC wants to merge 1 commit into
Open
Conversation
Add InjectBase65536 and InjectHexagram to probes.encoding, addressing two items from the "extra encodings" wishlist (issue NVIDIA#152). Both encoders are clean-room ports of the MIT-licensed reference implementations (qntm/base65536 and ferno/hexagram-encode) placed in resources.encodings with attribution, so no new runtime dependency is introduced. The base65536 port is validated byte-for-byte against the reference; the hexagram port matches the reference README vector. Adds roundtrip, known-vector, and invalid-input tests in tests/resources/test_encodings.py. The new probes are also covered by the existing parametrized probes.encoding test suite. Signed-off-by: ANIS <119749586+assinscreedFC@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two new encoding-injection probes to
probes.encoding, addressing two items from the "extra encodings" wishlist in #152:InjectBase65536— encodes payloads with Base65536 (2 bytes per character).InjectHexagram— encodes payloads as I Ching hexagrams (Base64 with each character mapped to a hexagram so the bits are visible).Both follow the existing
EncodingMixinpattern (primary_detector = encoding.DecodeMatch).Dependencies
No new runtime dependency is introduced. Both encoders are clean-room ports of the MIT-licensed reference implementations, placed in
resources/encodings.pywith attribution comments andSPDX-FileCopyrightTextlines:base65536_encode/decode— ported from qntm/base65536 (MIT). Validated byte-for-byte against the reference package.hexagram_encode/decode— ported from ferno/hexagram-encode (MIT). Matches the reference README vector (bytes([0x00,0x55,0xFF]) -> ䷁䷣䷄䷀).Non-duplication
No open PR addresses these encoders (checked
base65536,hexagram, and#152references in open PRs). This PR covers only two wishlist items; #152 stays open for the rest.Tests
New
tests/resources/test_encodings.pyadds roundtrip, known-vector, and invalid-input tests for both codecs. The new probes are also covered by the existing parametrizedtests/probes/test_probes_encoding.pysuite.Codec ports were additionally verified with the
base65536reference package uninstalled, confirming no dependency.AI assistance
This change was AI-assisted (Claude). The human submitter has reviewed every changed line and run the tests above.