-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add Base91 detection (Magic) and tests #2120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ialejandrozalles
wants to merge
10
commits into
gchq:master
from
ialejandrozalles:feature/add-base91-official
Closed
Add Base91 detection (Magic) and tests #2120
ialejandrozalles
wants to merge
10
commits into
gchq:master
from
ialejandrozalles:feature/add-base91-official
Conversation
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
- Add complete Base91 implementation based on Joachim Henke's basE91 algorithm - Includes both encoding (ToBase91) and decoding (FromBase91) operations - Uses 91 printable ASCII characters for optimal space efficiency - Better space efficiency than Base64 while maintaining readability - Proper error handling for invalid characters during decoding - Full JSDoc documentation Files added: - src/core/lib/Base91.mjs - Core Base91 implementation library - src/core/operations/ToBase91.mjs - Base91 encoding operation - src/core/operations/FromBase91.mjs - Base91 decoding operation - Updated Categories.json to include Base91 operations Author: Izai Alejandro Zalles Merino <[email protected]> Technical details: - Algorithm: Based on basE91 by Joachim Henke (http://base91.sourceforge.net/) - Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%&()*+,./:;<=>?@[]^_`{|}~" - Input types: ArrayBuffer for encoding, string for decoding - Output types: string for encoding, ArrayBuffer for decoding
Update chef.help() test to expect 15 results instead of 13 due to the addition of Base91 operations (ToBase91 and FromBase91) which are now included when searching for 'base 64'.
33c9fbf
to
d6ec763
Compare
- Add detection checks for "From Base91" (regex heuristic), consistent with existing Base64/Base85 patterns - Regenerate OperationConfig.json via script to keep metadata in sync - Add unit tests for Base91 encode/decode and a Magic chain test for Base91 Authored-by: Izai Alejandro Zalles Merino <[email protected]>
- Disable no-useless-escape locally for Base91 regex string assembly - Fix trailing spaces - Tidy comma placement in Magic tests Authored-by: Izai Alejandro Zalles Merino <[email protected]>
- Add Magic checks for common Morse format using forward slashes between words - Cover dot/dash, underscore/dot, and dash/dot literal formats with slashes Authored-by: Izai Alejandro Zalles Merino <[email protected]>
- Add Magic checks to Optical Character Recognition to detect common image formats via magic bytes - Provide default args (show confidence, LSTM engine) when auto-suggested Authored-by: Izai Alejandro Zalles Merino <[email protected]>
…st option - Render Image (browser): overlay a small ✎ button linking to an OCR recipe for quick access - OCR: add optional "Character whitelist" arg and apply via tesseract parameter to improve accuracy on restricted alphabets Authored-by: Izai Alejandro Zalles Merino <[email protected]>
fbd58b9
to
d3c512e
Compare
…dles HMR strings); feat(ocr): add 'Remove line breaks' checkbox to return text without newlines
… format) with Magic detection; add to Encryption/Encoding category
…jandrozalles/CyberChef into feature/add-base91-official
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.
This PR adds Base91 detection to CyberChef Magic and includes unit tests.
Summary
Rationale
Base91 provides better space efficiency than Base64 with a larger ASCII alphabet. Adding detection helps users quickly identify Base91-encoded data.
Implementation details
Authored-by: Izai Alejandro Zalles Merino [email protected]