8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
1/7
Encryption and
Decryption by
using Block and
Ceaser Cypher
Abu bakar Dawood
Mts 32 Syn A
Submitted to:
Mam Uzma Akbar
Dated: May 1, 2011
8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
2/7
2
Table of Contents Page #
1 Introduction 3
2 Methodology 3
3 Experimentation 4
4 Experimental Result 7
5 Conclusion 7
6 Abstract 7
8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
3/7
3
1.IntroductionThe concept of encryption and decryption can be basically used in the fields where there is
needed some encoding for the communication of highly confidential documents or messages.
The block cypher converts the entered data in to the form so that the number are mixed in such
a way that there is the next sixth character after the first .While the Ceaser cypher is rather more complicated as compared to the block cypher. In this
type the program asks the user to enter the shift that is the number upto which the phrase
should be jumped. If the number entered is 1 then the program will print b instead of a.
The program was designed purely for this purpose and the objective is that this program can
easily encode the words either in upper case or the lower case and can also work efficiently
even if they are intermixed.
2.MethodologyThe problem of Block Cypher can be handled by using nested FOR loops the outer initializing
from 0 and working under the condition if the variable works less than and equal to 5 while the
nested loop initializes from the 0 and works if the variables varies equal and less than 35. The
variables in the first loop increases by 1 while in the nested the loop increases by 6.
The output is written inside the nested loop and the is as follow
Array[variable in the first loop +variable in the second loop].
Hence the output is in the form such that the sixth letter is printed after the first.
The decryption can be done in the same way.
The problem in the Ceaser Cypher can be handled by using the ASCII codes.
The user enters the data that is to be encrypted and then adds the Shift number in the ASCIIcodes that is also the user defined. The character of that ASCII number is printed and hence it is
in the encrypted form.
If the ASCII codes for the lower case letters exceed by 122 then 26 are subtracted from the ASCII
hence the appropriate character is printed.
Similarly for Decoding the shift parameter is subtracted from the ASCII and if the ASCII falls by
97 after subtraction then 26 is added to get the appropriate number.
3.Experimentation#include // header filevoid main() // main program starts
{ char ch; // defining the characters
int a,b,c, result,shift,r; //initialinzing the integer
for(int i=1;;i++) //starting the for loop
{
unsigned char input[37]={0}; //initializing the string
unsigned char caeser[37]={0}; //initializing the string
char encrypt[37]={0}; //initializing the string
cout
8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
4/7
4
cout
8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
5/7
5
else if ((64
8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
6/7
6
result=(int)caeser[j]-shift; // the ascii of the decrypted letter
if ((96
8/7/2019 Encryption and Decryption by Using Block and Ceaser Cyphe1
7/7
7
4.Experimental ResultsWhen the program was used then the result were in accordance with the given task.
When the phrase of 36 characters was entered then the result was the encrypted either in block
or caeser cypher according to the will of the user.
Similarly when then encrypted code was entered in then the result of the program was to
decode that one and that was easily done by it according to the requirements of the project.
5. ConclusionThe conclusion this project report is that I have deliberately performed this task and I am happy
that it is working perfectly in accordance with the cited requirements of the project.
The objective of the program the encryption and decryption of the phrases is very useful for the
communication of highly confidential documents and hence it the initial step for the
development of other useful programs like this.
Abstract:
The poblem being handled in the project is the encryption and decrytion of the entered phrases
by using the Block and the Caeser cyphers. There were some problems while making this project like the
printind of ASCII codes when we needed to print the characters. And also the logic being used in the
Caeser Cypher. Block Cypher was encrypted and decrypted by using nested for loops while the caeser
problem was solved by using the ascii codes and the shift being added or subtracted into the ascii codes
according to the encryption or the decryption. Moreover another major problem the printing of theUpper case and the lower case letters seperately as both of them got entangled with one another and
this problem took a long time to be eradicated.
Top Related