Posts

Showing posts with the label Caesar Cipher

Caesar Says hello world!

Few months back there was a problem set on  Caesar cipher  and it struck to me to write this one for the readers who are interested to learn about Caesar cipher.  Let's get started, in Caesar cipher we have predefined mapping of the 26 English alphabets with numbers from 0-25. Letter A corresponds to 0, letter B corresponds to 1, C corresponds to 2 and so on till Z corresponds to 25. Mathematically,  Cipher text, C = (P+K) % 26 . Where P is the plain text and K is key between 1 to 25. We cannot use K=0 as it will give back the same letters as plain text. Plain text, P = (C-K) % 26 . Where C is the cipher text obtained after encryption. That was the vanilla Caesar cipher, now what about writing " hello world! " in Caesar Cipher. The task seems simple however note that the vanilla Caesar cipher does not have mapping for space and exclamation mark (!) symbols. Let us design our own mapping similar to that of vanilla mapping with these two symbols. We...