Caesar cipher is a basic substitution cipher that uses a key for encryption/decryption and it's implemented here using C++.
Caesar cipher is an encryption and decryption algorithm that is used to create ciphertexts and it comes under substitution ciphers. In caesar cipher, a key is used to substitute the character with another character and that is how whole plain text is encrypted.
Encryption is the process of encoding a message in such a way that it can’t be decoded by others without a proper key. A text message before encryption is known as plain text and an encrypted form of plain text is called ciphertext.
In Caesar cipher, encryption can be represented as : E(x) = (x+n) mod 26 ; Here 'x' stands for the character being encrypted
Here ‘mod 26’ (also represented in code as ‘%26’) is done to make sure that the key substitutes the text characters by alphabets only.
For example : 40 mod 26 = 14
Also decryption can be represented as : D(x) = (x-n) mod 26
Caesar cipher is the most basic type of encryption and hence its security is disputed.
Submitted by Anshuman Prakash (devsecansh)
Download packets of source code on Coders Packet
Comments