TEXT ENCRYPTION
A simple “Text Encryption” method can be implemented in accordance to the following simple rules:
a) We match the letters of the alphabet (Latin) with the numbers 0 to 25.
b) We assume the existence of a Text K and a Key-word of N letters.
c) We take the first character of the Text K we want to “Encrypt” and we create another character specified by the ASCII Numbers Sum of
this character and the first Key-word character.
d) If the sum is out of range in respect to the total number of characters in the alphabet we proceed by subtracting 26 from that number.
e) We continue the process with the second character of the Text K we want to “Encrypt” and correspondingly the second character of the Key-word.
f) We continue to the last character in Text K.
g) Each time we run out of Key-word letters we initialise and take the first letter of the Key-word again (i.e. we use the letters in the
Key-word in recycling manner).
A C++ program to implement “Encryption” and “Decryption” of any given text provided as a “.txt” file needs to be able to accept three parameters:
1. Parameter “-enc” or “-dec”: This parameter will determine the action to be performed (“Encryption” or “Decryption”).
2. “-cipher” : Determines the key word (up to 10 characters, for the Algorithm we develop here).
3. : the filename which contains our text to be “Encrypted”.
Example:
text.txt (content): Attack at dawn.
Command: CppCryptography –enc –cipher lemon test.txt
Program Output: lxfopv mh oeib
Test.enc (content): lxfopv mh oeib.
Command: CppCryptography –dec –cipher lemon test.enc
Program Output: Attack at dawn.
Download "Cryptography"