Repository navigation
FEAT: Add Base91Converter (base91 binary-to-text encoding) - #4441
Open
Roman Lutz (romanlutz) wants to merge 1 commit into
Open
Roman Lutz (romanlutz) wants to merge 1 commit into
Roman Lutz (romanlutz) wants to merge 1 commit into
Conversation
Add a pure-Python Base91 converter (no third-party dependency) and register it as an ALL-only technique in the garak Encoding scenario, with a unit test and a doc example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Expanding all prevents previously saved Encoding runs from resuming, and the Base91 encoder’s 14-bit branch lacks boundary and zero-value test coverage.
2 open issues
What changed in this PR
Adds dependency-free Base91 encoding to PyRIT’s converter library and makes it available in the garak Encoding scenario.
Changes:
- Implements UTF-8 text-to-Base91 conversion and exposes it through lazy package exports.
- Registers Base91 as an
ALL-only encoding technique, leaving the default selection unchanged. - Adds converter unit tests and a Python-format documentation example.
| File | Description |
|---|---|
tests/unit/scenario/garak/test_encoding.py |
Updates the technique count and ALL-only expectations. |
tests/unit/converter/test_base91_converter.py |
Tests known vectors, Unicode, empty input, and supported types. |
pyrit/scenario/scenarios/garak/encoding.py |
Registers the Base91 technique and converter variant. |
pyrit/converter/base91_converter.py |
Implements the pure-Python Base91 converter. |
pyrit/converter/__init__.py |
Adds public lazy exports for Base91Converter. |
doc/code/converters/1_text_to_text_converters.py |
Adds a Base91 conversion example. |
Review effort: Balanced
| LeetSpeak = ("leet_speak", {"default"}) | ||
| AsciiSmuggler = ("ascii_smuggler", set[str]()) | ||
| Bifid = ("bifid", set[str]()) | ||
| Base91 = ("base91", set[str]()) |
| # Reference basE91 vector: "Hello World!" -> ">OwJh>Io0Tv!8PE". | ||
| converter = Base91Converter() | ||
| result = await converter.convert_async(prompt="Hello World!", input_type="text") | ||
| assert result.output_text == ">OwJh>Io0Tv!8PE" |
Roman Lutz (romanlutz)
marked this pull request as ready for review
November 19, 2026 23:38
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 a pure-Python Base91 binary-to-text converter (no third-party dependency) and registers it as an ALL-only technique in the garak Encoding scenario, with a unit test and a doc example.
Part of a series splitting the gap-1 converter set into reviewable per-converter / per-base PRs (template PR — opened as draft while the layout is confirmed).
🤖 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):