Sie sind auf Seite 1von 13

ENCRYPTION AND DECRYPTION

Atul Sharma
Bonafide Certificate

Will be provided to u by school

1
Index

S.No Content Page no


1 Acknowledgement 03
2 Abstract 04
3 Introduction 05
4 Program Code 06
5 Sample Output 09
6 Bibliography 12

2
Acknowledgement

The success and final outcome of this project required a lot


of guidance and assistance from many people and I am
extremely privileged to have got this all along the
completion of my project. All that I have done is only due
to such supervision and assistance and I would not forget
to thank them.
I would like to express my special thanks of gratitude to
my teacher Allpious.R as well as our principal M.
Poovanan who gave me the golden opportunity to do this
wonderful project on the topic Encryption and Decryption,
which also helped me in doing a lot of Research and I came
to know about so many new things I am really thankful to
them.
Secondly, I would also like to thank my parents and friends
who helped me a lot in finalizing this project within the
limited time frame.

3
Abstract

Encryption and Decryption, a type of cryptography, refers


to the process of scrambling information so that the
observer cannot detect the data.
At present, there are many encryption and decryption,
especially in the communication system provided in a
variety of application.
Encryption and decryption is particularly impacted in the
field of military communications and reliable security
data to protection for transmitting.
Encryption is the process of encoding data to prevent
unauthorized parties from viewing or modifying and it is
said to occur when data is passed through a series of
mathematical operations that generate an alternate form
of that data; the sequence of these operations is called
an algorithm. To help distinguish between the two forms of
data, the unencrypted data is referred to as the plaintext
and the encrypted data as ciphertext.
Decryption is the process of converting ciphertext back to
plaintext by reversing the algorithm used or by using a key
that was used to encrypt the data.

4
Introduction

Encryption is very necessary when it`s about internet and


networking to keep the personal information safe and
secure.
This has become a very important as while online banking
or shopping to keep the passwords and sensitive data such
as login credentials to different sites safe and private.
Hence this Caesar Cipher program will help the beginners
to learn and know about the encryption and decryption.
The sample code is simple and straight forward to
understand.
In the program six header files has been used they are:
(a). <iostream.h>
(b). <string.h>
(c). <conio.h>
(d). <fstream.h>
(e). <cype.h>
(f). <process.h>

5
Program Code
#include<iostream.h>
#include<string.h>
#include<conio.h>
#include<fstream.h>
#include<process.h>
#include<ctype.h>
class Encrypt
{ private:
char line[80];
int key;
public:
void getdata();
void enc();
void dec();
void mix();
};
void Encrypt::getdata()
{ cout <<"\n\n\tEnter your text document to encrypt: "<<"\n\t";
cin.getline(line,500);
}
void Encrypt::enc()
{ int length;
char *enc;
key = 4;
enc = line;
length = strlen(line);

6
for (int i = 0; i < length; i++) {
*enc += key;
enc++;
}
cout << "\n\tEncrypted text is: \n\t" <<line<<endl;
}
void Encrypt::dec()
{ int length,pin;
char *dec;
char ch;
key = 4;
dec = line;
length = strlen(line);
for (int i = 0; i < length; i++) {
*dec -= key;
dec++;
}
cout<<"\n\tDo you wish to decrypt the file(Y/N)"<<endl;
cin>>ch;
if(toupper(ch=='Y'))
{cout<<"\n\tPlease enter the end server key to decrypt the text:"<<endl;
cin>>pin;
if(pin==1220)
{ cout << "\t\nDecrypted text is: \n\t" << line << endl;
getch();
}
else

7
{cout<<"\n\tWrong key,plz try again!!"<<endl;
exit(0);
}}
else
cout<<"\n\tThank you. You are exiting";
}

void Encrypt::mix()
{ char rply;
cout<<"\t\t\nDo you want to save the file(Y/N)\n\t";
cin>>rply;
if(toupper(rply=='Y'))
{ofstream save("file.txt;ios::out;");
save<<line;
save.close();}
else
exit(0);}

void main ()
{
Encrypt text;
cout<<"\t\t\t\t\tWelcome\n\tThis is a Ceaser Cipher Program Helping you keep your File
Safe'\ n"<<endl;
text.getdata();
text.enc();
text.mix();
text.dec();
}

8
Sample output

9
10
11
Bibliography

1. Computer Science with C++ by Sumita Arora

2. www.tutorialspoint.com/cplusplus/

3. www.geekforgeeks.org/c-plus-plus/

4. www.reddit.com/r/cpp

12

Das könnte Ihnen auch gefallen