Skip to content

Add Trithemius cipher codec#28

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-new-encoding-trithemius
Draft

Add Trithemius cipher codec#28
Copilot wants to merge 2 commits intomainfrom
copilot/add-new-encoding-trithemius

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 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 Trithemius cipher is a polyalphabetic substitution cipher invented by German abbot Johannes Trithemius. It applies progressive Caesar shifts (0, 1, 2, …) to each successive letter, leaving non-alphabetic characters in place — equivalent to a Vigenère cipher with key "ABCDEFGHIJKLMNOPQRSTUVWXYZ...".

New codec: src/codext/crypto/trithemius.py

  • Supports codec names trithemius and trithemius-cipher
  • Shifts only [a-z]/[A-Z] characters; position counter advances on letters only
  • Passes through digits, spaces, and punctuation unchanged
import codext
codext.encode("this is a test", "trithemius")   # → "tikv mx g ambd"
codext.decode("tikv mx g ambd", "trithemius")   # → "this is a test"
codext.encode("HELLO", "trithemius")            # → "HFNOS"

__examples__ covers exact encode/decode pairs, empty input, uppercase, non-alphabetic-only strings, and enc-dec roundtrip with random data (picked up automatically by tests/test_generated).

Original prompt

This section details on the original issue you should resolve

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

The Trithemius cipher is a polyalphabetic encryption method invented by the German abbot Trithemius. This code is a sequence of shifts from 0 to N shift in the alphabet.

Source: dCode

Reference

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

<agent_instructions>Propose an implementation according to the guideline in docs/pages/howto.md.</agent_instructions>

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: dhondta <9108102+dhondta@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dhondta/python-codext/sessions/f1d18334-920c-498b-8516-13b37307b393
Copilot AI changed the title [WIP] Add new encoding for trithemius cipher Add Trithemius cipher codec Mar 22, 2026
Copilot AI requested a review from dhondta March 22, 2026 21:10
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: trithemius

2 participants