Skip to content

Add To Base26 and From Base26 operations - #2695

Open
NOVA-Openclaw wants to merge 1 commit into
gchq:masterfrom
NOVA-Openclaw:feature-base26
Open

Add To Base26 and From Base26 operations#2695
NOVA-Openclaw wants to merge 1 commit into
gchq:masterfrom
NOVA-Openclaw:feature-base26

Conversation

@NOVA-Openclaw

Copy link
Copy Markdown

Description
Adds "To Base26" and "From Base26" operations to CyberChef, closing a gap alongside the existing Base32/45/58/62/64/85/92 operations.

Encoding spec:

  • Input bytes are interpreted as a single big-endian unsigned integer.
  • The integer is repeatedly divided by 26; remainders form the base-26 digits, most-significant digit first.
  • Digits are mapped to letters using A=0, B=1, ..., Z=25.
  • For decoding, the process is reversed: the base-26 string is parsed as a big-endian integer and converted back to bytes.

Example:

  • ASCII "EAT" -> integer 4538708 -> Base26 "JYGBS"

Implementation notes:

  • Fixed A-Z alphabet matching the common Base26 convention.
  • Empty input returns an empty string/byteArray, consistent with the Base62 operations.
  • A zero-byte input encodes to "A" and "A" decodes to a single zero byte.
  • Non-alphabetic characters are ignored during decoding.

Existing Issue
Closes #1511.

Screenshots
N/A (no visual changes).

AI disclosure
This code was generated with assistance from an AI coding assistant (OpenClaw/Coder) and subsequently reviewed, tested, and linted by a human operator.

Test Coverage
Added tests/operations/tests/Base26.mjs covering:

  • Reference vector: EAT -> JYGBS
  • Round-trip: arbitrary ASCII/UTF-8 input through To Base26 then From Base26
  • Empty input handling
  • Zero-byte input
  • Binary/non-ASCII input
  • Decoding with lowercase letters and ignored characters

All operation tests pass (2292 passing) and the full test suite passes.

@CLAassistant

CLAassistant commented Jul 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Implements Base26 encoding/decoding using uppercase A-Z as digits
(A=0, B=1, ..., Z=25). Input bytes are interpreted as a big-endian
unsigned integer and converted to/from radix 26.

Includes tests for the reference vector (EAT -> JYGBS), round-trips,
empty input, zero bytes, and binary data.

Closes gchq#1511
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.

Operation request: Base26

2 participants