Caesar Cipher program

Caesar Cipher is a form of cryptography. And is one of the modelsor the conventional forms of Symmetric Cryptography. What is meant by symetric cryptography Symmetric cryptography or key that is used to perform encryption and decryption are the same.
* Plaintext is a message sent and easy to understand.
* Ciphertext is plaintext that has been modified with a method thatneeds a special effort to understand its contents.
* To have encrypted data can be read back then it needs to bedecrypted by using the same shared key encryption when done. Soshared key (public key) is the current regulations do encryption anddecryption.

Some classic examples of conventional encryption:
A. Caesar Cipher
Is an encryption method performed at the time of Julius Caesar. The alphabet is only used in either uppercase or lowercase. So thatwhen the process is performed on the numbers then it is not possible. Way encryption of this method is to rotate the three steps.This form of encryption is as follows:
abcdefghijklmnopqrstu vwxyz
DEFGHIJKLMNOPQRSTUVWX YZABC
Example in its c + + as follows:

#include <cstdlib>
#include <iostream>
#include <string.h>
#define maks 500

using namespace std;

class Enkripsi{
public:
Enkripsi();
void enkripsi();
void deskripsi();
void output();
private:
char chiper[maks];
int key;
char plain[maks];
};
Enkripsi::Enkripsi(){
cout<<"get a word : ";
cin.getline(chiper,sizeof(chiper));
cout<<"get the key :";
cin>>key;
cout<<endl;
}
void Enkripsi::enkripsi(){
for(int i=0;i<strlen(chiper); i+=1){
cout<<chiper[i]<<"("<<int(chiper[i])<<")";
chiper[i]=(chiper[i]+key)%128;
}
}
void Enkripsi::deskripsi(){
for(int i=0;i<strlen(chiper);i+=1){
plain[i]=(chiper[i]-key)%128;
chiper[i]=plain[i];
}
}
void Enkripsi::output(){
for(int i=0;i<strlen(chiper);i+=1){
cout<<chiper[i];
}
}

int main(int argc, char *argv[])
{
Enkripsi Deskripsi;
Deskripsi.enkripsi();
cout<<"\n\nAfter the encryption : ";
Deskripsi.output();
Deskripsi.deskripsi();
cout<<"\n\nback in the description: ";
Deskripsi.output();
cout<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}
 good luck.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: