Tuesday, January 31, 2012

[C++] Caesar Cipher (Alphabet)

          Hello, Reader ^^! Back again with source code ^^! This time the source code is Caesar Cipher for Alphabet only. The source code written in C++. This is a classic encryption method used by a caesar to send secret message. This application can encrypt plaintect into ciphertext using key and decrypt ciphertext using key and exhaustive search. Now, for some simple explanation. Just say I have word "Virucodesoup". I want to encrypt it. I use key = 10 which rotate letters by 10 which turns "Virucodesoup" into "FSBEMYNOCYEZ". Here's some formula of encryption: 

En(x) = (x + n) mod 26 [1]

From the example, if you put V, it will be rotated into F. For the decryption, here's some formula:

Dn(x) = (x - n) mod 26 [1]

From the example, if you put F, it will be rotated into V. Okay, that's all I can say. Thank you for reading ^^!

Extra Credit
-[1]Formula based on Wikipedia

Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository)

No comments:

Post a Comment