Preserving History Through Code- Caesar Cipher
Project description
Preserving History Through Code- Julius Caesar's Shift Cipher
Gaius Julius Caesar
From Wikipedia, the free encyclopedia
In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code, or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.
<img src="/images/julius_caesar.png"
width="400"
align="center"
margin="100"
alt="The Caesar cipher is named for Julius Caesar, who used an alphabet where decrypting would shift three letters to the left.."
caption="Gaius Julius Caesar"
/>
<div align="center">Julius Caesar (100-44 BCE)</div>
Source: Wikipedia
Caesar cipher using a left rotation of three places
Expectations
Plain : ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW
Plaintext : THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD
<img src="/images/caesar_cipher_left_shift_of_3.png"
width="400"
align="center"
margin="100"
alt="The action of a Caesar cipher is to replace each plaintext letter with a different one a fixed number of places down the alphabet. The cipher illustrated here uses a left shift of three, so that (for example) each occurrence of E in the plaintext becomes B in the ciphertext."
caption="The action of a Caesar cipher"
/>
<div align="center">The action of a Caesar cipher</div>
Source: Wikipedia
Caesar cipher disk was invented over a millemium after Julius Caesar
But we would borrow Alberti's disc to also visualize the Caesar's Cipher
<img src="/images/alberti_cipher_disk.png"
width="400"
align="center"
margin="100"
alt="CipherDisk2000"
caption="Cipher disc for substitution cipher, manufacturer: Linge, Pleidelsheim (Germany)"
/>
<div align="center"><br>CipherDisk2000 invented by <a href="https://en.wikipedia.org/wiki/Leon_Battista_Alberti">Leon Battista Alberti</a> <i>1404 - 1472</i></div>
Source: Wikipedia
Caesar cipher using a left rotation of three places
With a left shift of 3, D would be replaced by A, E would become B, and so on.
The cipher disk illustration was inspired by Alberti's cipher disk, although his disk had the outer disk as the rotating disk and it was also in the reverse order compared to the inner disk.
<br>
<img src="/images/cipher_disk_shift_0.png"
width="300"
align="center"
margin="100"
alt="CipherDisk in 0 position 0 Shift"
caption="Cipher disc default position"
/>
<div align="center">CipherDisk in 0 position 0 Shift</div>
<br>
<img src="/images/cipher_disk_shift_3.png"
width="300"
align="center"
margin="100"
alt="CipherDisk with 3 left rotations or -3 Shift"
caption="Cipher disc 3 left rotations"
/>
<div align="center">Cipher disc 3 left rotations</div>
Focus
This caesar cipher program encrypts only uppercase letters and no other characters. Modelled closely to the caesar cipher used before common era.
Install
pip install jc_cipher
Run in command/terminal
jc_cipher
Import modules
from caesar_cipher import encryption as ce
from caesar_cipher import decryption as de
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jc_cipher-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c55c9653017a264c19fdc7163fb5dff3b6b8703df57ecc7e282a50afda6178fc |
|
MD5 | ae92157774e7e01b51c3b6aa4cc2fc19 |
|
BLAKE2b-256 | 49468750b4d4fdd87da8b4417484958712b1d4c695ee0991cee98db750365d7d |