Repository navigation
FEAT: Add PolybiusConverter (polybius converter) - #4443
Open
Roman Lutz (romanlutz) wants to merge 3 commits into
Open
Roman Lutz (romanlutz) wants to merge 3 commits into
Roman Lutz (romanlutz) wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Merge-letter validation accepts multi-character entries, allowing invalid grid coordinates or construction-time KeyErrors instead of the documented ValueError.
2 open issues
What changed in this PR
Adds PolybiusConverter to PyRIT’s text-encoding converters and makes it available in the Garak Encoding scenario.
Changes:
- Implements configurable Polybius-square encoding with merged letters and coordinate separators.
- Exports the converter and registers it as an ALL-only encoding technique.
- Adds unit coverage, identifier samples, and a Python documentation example.
| File | Description |
|---|---|
tests/unit/scenario/garak/test_encoding.py |
Updates technique counts and ALL-only expectations. |
tests/unit/registry/converter_identifier_samples.py |
Adds custom merge-letter samples for identifier checks. |
tests/unit/converter/test_polybius_converter.py |
Covers encoding, configuration, validation, and identifiers. |
pyrit/scenario/scenarios/garak/encoding.py |
Registers the Polybius technique and converter variant. |
pyrit/converter/polybius_converter.py |
Implements Polybius-square text encoding. |
pyrit/converter/__init__.py |
Adds the public lazy export and typing import. |
doc/code/converters/1_text_to_text_converters.py |
Adds a Polybius conversion example. |
Review effort: Balanced
| first, second = merge_letters | ||
| first = first.upper() | ||
| second = second.upper() | ||
| if first not in _ALPHABET or second not in _ALPHABET: |
| print("ROT13:", await ROT13Converter().convert_async(prompt=prompt)) # type: ignore | ||
| print("Base64:", await Base64Converter().convert_async(prompt=prompt)) # type: ignore | ||
| print("Base2048:", await Base2048Converter().convert_async(prompt=prompt)) # type: ignore | ||
| print("Polybius:", await PolybiusConverter().convert_async(prompt=prompt)) # type: ignore |
This was referenced Nov 20, 2026
This branch has not been deployed
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.


Adds this converter as part of the gap-1 converter series (splitting the esoteric cipher / encoder set into per-converter and per-base PRs). Includes a unit test and garak Encoding-scenario registration; CI-validated locally.
Sibling PRs will be cross-linked once the series is open.
🤖 Generated with Claude Code
gap-1 converter series — splitting the esoteric cipher / encoder set into reviewable PRs (open each independently; they touch the same four registration files, so later ones rebase as earlier ones merge):