Showing posts with label decrypt. Show all posts
Showing posts with label decrypt. Show all posts

Wednesday, February 1, 2012

[C++] Caesar Cipher (ASCII)

          Hello, Reader ^^! Back again with source code ^^! This time the source code is Caesar Cipher for ASCII. How it works it is still same with the Alphabet version. The only differences are this time it is not limited to alphabet anymore, but it is ASCII. Plus, the effective key is increased to 256 keys. Plus, with that, the formula for encryption is:

En(x) = (x + n) mod 256

While the formula for decryption is:

Dn(x) = (x - n) mod 256

For example, I use "HeLLo WoRlD!". I encrypt it with key = 122. It will be rotated into "Â߯ÆéšÑéÌæ¾›". Okay, that's all I can say ^^! Thank you for reading ^^!





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





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)