Skip to content

Conversation

ialejandrozalles
Copy link

@ialejandrozalles ialejandrozalles commented Oct 1, 2025

This PR adds Base91 detection to CyberChef Magic and includes unit tests.

Summary

  • Introduces detection checks for "From Base91" using a regex heuristic, aligned with existing Base64/Base85 patterns (minimum 15 consecutive Base91 chars, allowing whitespace)
  • Keeps OperationConfig.json generated via the official script for consistency
  • Adds tests:
    • Base91 encode/decode roundtrips
    • Magic chain detection for Base91

Rationale
Base91 provides better space efficiency than Base64 with a larger ASCII alphabet. Adding detection helps users quickly identify Base91-encoded data.

Implementation details

  • Detection integrated in FromBase91.mjs via this.checks, mirroring the approach used by Base64/Base85
  • OperationConfig is re-generated so metadata remains in sync with operation definitions
  • Tests pass locally (operations test suite)

Authored-by: Izai Alejandro Zalles Merino [email protected]

- 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'.
@ialejandrozalles ialejandrozalles force-pushed the feature/add-base91-official branch from 33c9fbf to d6ec763 Compare October 1, 2025 16:54
- 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]>
@ialejandrozalles ialejandrozalles changed the title Add Base91 encoding/decoding operations Add Base91 detection (Magic) and tests Oct 13, 2025
- 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]>
@ialejandrozalles ialejandrozalles force-pushed the feature/add-base91-official branch from fbd58b9 to d3c512e Compare October 13, 2025 14:40
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.

1 participant