Skip to content

Add Bazeries cipher codec - #34

Draft
dhondta with Copilot wants to merge 4 commits into
mainfrom
copilot/add-bazeries-encoding
Draft

Add Bazeries cipher codec#34
dhondta with Copilot wants to merge 4 commits into
mainfrom
copilot/add-bazeries-encoding

Conversation

CopilotAI commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

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 *
>>>importcodext, 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
CopilotAI changed the title [WIP] Add new encoding: BazeriesAdd Bazeries cipher codecMar 23, 2026
CopilotAI requested a review from dhondtaMarch 23, 2026 23:19
@dhondta
dhondtaforce-pushed the main branch 3 times, most recently from d232268 to b5414ecCompareMarch 29, 2026 21:01
@dhondta

Copy link
Copy Markdown
Owner

@copilot please remove Vigenere from this PR, it is already implemented in src/codext/crypto/vigenere.py.

Sign up for freeto 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

@dhondta