Skip to content

Latest commit

 

History

History
13 lines (8 loc) · 1008 Bytes

README.md

File metadata and controls

13 lines (8 loc) · 1008 Bytes

Caesar-Cipher

Exercise taken from www.sololearn.com, by their mobile app. It doesn't seem to be available through desktop's browser.

Code for encripting a message using the Caesar Cipher method The Caesar cipher is one of the earliest known and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is shifted to a certain number of places down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is named after Julius Caesar, who allegedly used it to communicate with his generals.

Here is a quick example of the encryption and decryption steps involved with the Caesar cipher. The text we will encrypt is "defend the east wall of the castle," with a shift (key) of 1.

Plaintext: "defend the east wall of the castle" Ciphertext: "efgfoe uif fbtu xbmm pg uif dbtumf"

It is easy to see how each character in the plaintext is shifted up the alphabet. Decryption is just as easy, by using an offset of -1.