Skip to content

Add Vigenère cipher codec#24

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-new-encoding-vigenere
Open

Add Vigenère cipher codec#24
Copilot wants to merge 2 commits intomainfrom
copilot/add-new-encoding-vigenere

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

Implements the Vigenère cipher — a polyalphabetic substitution cipher that applies a series of interwoven Caesar shifts driven by a repeating keyword. Non-alpha characters pass through unchanged; case is preserved per character.

New file: src/codext/crypto/vigenere.py

  • Pattern: vigen[eè]re[-_](?:cipher[-_])?KEY — accepts both - and _ separators, the accented spelling (vigenère), and an optional cipher infix
  • Key is normalised to lowercase; non-alphabetic or empty keys raise LookupError
  • __examples__ covers the canonical Wikipedia test vector, case preservation, and round-trip fidelity
import codext

codext.encode("ATTACKATDAWN", "vigenere-lemon")  # → "LXFOPVEFRNHR"
codext.decode("LXFOPVEFRNHR", "vigenere-lemon")  # → "ATTACKATDAWN"

codext.encode("Hello World", "vigenere-key")     # → "Rijvs Uyvjn"
Original prompt

This section details on the original issue you should resolve

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

Method of encrypting alphabetic text by using a series of interwoven Caesar ciphers based on the letters of a keyword. Though the 'chiffre indéchiffrable' is easy to understand and implement, for three centuries it resisted all attempts to break it.

Source: Cryptii

Reference

https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher</issue_description>

<agent_instructions>Please propose an implementation according to 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.

Copilot AI changed the title [WIP] Add new encoding: vigenere Add Vigenère cipher codec Mar 22, 2026
Copilot AI requested a review from dhondta March 22, 2026 15:06
@dhondta dhondta marked this pull request as ready for review March 22, 2026 16:15
@dhondta dhondta marked this pull request as draft March 22, 2026 16:17
@dhondta dhondta marked this pull request as ready for review March 22, 2026 16:26
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: vigenere

2 participants