Secure cipher but now breakable
At its core, the vigenere cipher is several Caesar ciphers, with a different shift value depending on the key. It can be computed simply by hand, through the use of a vigenere table. In code, it can be done using modulo arithmetic.
To encode, we first convert every letter to a number between 0 and 25, where A is 0, and Z is 25. If the key is shorter than the message, it is repeated until they are the same length, i.e. if the message is cryptography
, and the key is secretkey
:
msg = cryptography
key = secretkeysec
The ith character of the output O, can be computed from the message M, and key K using the follwing formula:
O[i] = (M[i] + K[i]) mod 26
Decoding the output O, into the message M knowing the key K, is just as simple:
M[i] = (O[i] - K[i]) mod 26
Language | Encrypt | Decrypt |
---|---|---|
Javascript | encrypt.js | decrypt.js |
Python | encrypt.py | decrypt.py |
C | vigenere.c | vigenere.c |
Tests are automatically handled by Travis CI.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Luka Lafaye - Initial work - @lukalafaye
- Arthur Guiot - Wrote JS Implementation - @arguoit
- Lucas Gruwez - Clean up work - @lucasgruwez
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details