The term Encryption is used to refer to the conversion of normal, human-readable data into an unreadable and meaningless collection of bytes. This is done for preventing unauthorised access to confidential data.The process used to extract the original data from the encrypted data is known as Decryption. There are several algorithms available for encrypting data, and each one has its own pros and cons.
File Encryption using Caesar Cipher
Here, we shall discuss File Encryption using Caesar Cipher (also known as Caesar Shift), a technique which was used by Julius Caesar in his private and military communications. This technique uses the method of substitution, i.e. replacing each letter in the text with another letter which is located after a fixed number of positions in the alphabet.
If you substitute each letter with another letter which comes three positions later, then the text
This website is Windows Code Bits
Wklv zhevlwh lv Zlqgrzv Frgh Elwv
As you can see in the above example, the text has been converted to a form which has no meaning and the original message has been thus concealed. Now, if we use a number larger than three, say 20 or 50, then the result would be more complicated and difficult to guess.
Given below is a C++ program to encrypt your data using this method.
5. If encryption is successful, a new file named b.dat is created in the same folder.
Open b.dat to view its contents. Obviously, you won’t be able to read its contents, because there will be lots of unreadable characters. Now, if you want to decrypt the file’s contents, you have the following two options :
a) Locate this statement : shift = -1978; in the above program and remove the – sign and re-build the program. Now place the .exe file in the same folder as the b.dat file which you want to decrypt. Run the .exe. The original file with the original text will be created with the name a.txt.
b) Download Decrypt.exe. Place it in the same folder as b.dat and run it. The original file with the original text will be created with the name a.txt.
The following video shows how Caesar Cipher works :
Please note that this method is one of the simplest ways to encrypt data. The data encrypted using this algorithm can be easily decrypted using the decryption programs available. No matter how large is the shift number, the data cannot be secured properly using this algorithm.
However, you can use it for securing your personal data from your friends and colleagues (who might not know anything about encryption).
Click here to download the Encrypt project (with source code).
Click here to download the Decrypt project (with source code).