Skip to content

Add Bazeries cipher codec#34

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-bazeries-encoding
Draft

Add Bazeries cipher codec#34
Copilot wants to merge 3 commits intomainfrom
copilot/add-bazeries-encoding

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

Checklist

  • No unrelated changes
  • Codec is new (not already implemented)
  • Tests included (if cannot be automated with tests/test_generated)
  • Documentation (included in the right page in docs/pages/enc)

Description

The Bazeries cipher (Étienne Bazeries, ~1901) combines two 5×5 Polybius squares with a digit-based transposition. A numeric key is spelled out in English to build the second square's alphabet; the key's digits define group sizes for reversing plaintext segments before cross-square substitution.

src/codext/crypto/bazeries.py

  • Numeric key (e.g. bazeries-137): spells out "ONE HUNDRED THIRTY SEVEN" → cipher alphabet; digits [1,3,7] → transposition group sizes
  • Keyword key (e.g. bazeries-CIPHER): keyword builds the cipher alphabet; word lengths → group sizes
  • Default key is 137 when none is provided
  • J→I merged per standard 5×5 square convention; non-alpha characters stripped

src/codext/crypto/__init__.py

  • Added from .bazeries import *
>>> import codext, codecs
>>> codecs.encode("HELLO", "bazeries-137")
'TSSUB'
>>> codecs.decode("TSSUB", "bazeries-137")
'HELLO'
>>> codecs.encode("THEQUICKBROWNFOX", "bazeries-137")  # round-trips cleanly
'LFUTBGNYEIMQBDAW'
Original prompt

This section details on the original issue you should resolve

<issue_title>Add new encoding: bazeries</issue_title>
<issue_description>### Description

The Bazeries cipher is an encryption system created by Étienne Bazeries that combines two Polybius grids (square arrays of letters) and a transposition supercipher based on a number or keyword.

Reference

https://www.dcode.fr/bazeries-cipher</issue_description>

<agent_instructions>Please propose an implementation that satisfies the guideline in docs/pages/howto.md.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Co-authored-by: dhondta <9108102+dhondta@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dhondta/python-codext/sessions/eb6480a3-5cd7-48be-a493-9552bb17e028
Copilot AI changed the title [WIP] Add new encoding: Bazeries Add Bazeries cipher codec Mar 23, 2026
Copilot AI requested a review from dhondta March 23, 2026 23:19
@dhondta dhondta force-pushed the main branch 2 times, most recently from baa938d to 8903aea Compare March 24, 2026 21:08
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.

Add new encoding: bazeries

2 participants