#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
void cih(char*,char*,int);
void main(){
clrscr();
char *plain,*key;
int i,plen,klen,count=0;
while(count<2){
cout<<"\nEnter Plain Text:";
cin>>plain;
cout<<"\nEnter Key Text:";
cin>>key;
plen=strlen(plain);
klen=strlen(key);
if(plen!=klen){
count=1;
cout<<"\nPlain Text and key Value length are not Same. Try Again !!!!";
}
if(plen==klen){
cih(plain,key,plen);
count=2;
getch();
exit(0);
}
}
//cout<<"\nSajay kumar";
}
void cih(char *pt,char *kv,int val){
char *plain,*key,*cyh;
plain=pt;
key=kv;
int pasc[50],kasc[50],i,xor[50],mul[50];
for(i=0;i<val;i++){
pasc[i]=plain[i];
kasc[i]=key[i];
xor[i]=pasc[i]^kasc[i];
cout<<pasc[i]<<"\t"<<kasc[i]<<"\t"<<xor[i]<<"\n";
mul[i]=xor[i]/26;
xor[i]=xor[i]%26;
xor[i]=xor[i]+97;
cyh[i]=xor[i];
}
cout<<"\nCipher Text Will be: ";
for(i=0;i<val;i++){
cout<<cyh[i]; //printing cypher Text
}
cout<<"\nDecrypted Text will be:";
//mul[] stores the queotent
char *dcyh;
int dval[50];
for(i=0;i<val;i++){
dval[i]=26*mul[i]+xor[i]-97; //generating original xor value
dval[i]=dval[i]^kasc[i]; //generating plain text ascii value
dcyh[i]=dval[i]; //Getting original text character
cout<<dcyh[i]; //printing original text
}
}
#include<conio.h>
#include<string.h>
#include<process.h>
void cih(char*,char*,int);
void main(){
clrscr();
char *plain,*key;
int i,plen,klen,count=0;
while(count<2){
cout<<"\nEnter Plain Text:";
cin>>plain;
cout<<"\nEnter Key Text:";
cin>>key;
plen=strlen(plain);
klen=strlen(key);
if(plen!=klen){
count=1;
cout<<"\nPlain Text and key Value length are not Same. Try Again !!!!";
}
if(plen==klen){
cih(plain,key,plen);
count=2;
getch();
exit(0);
}
}
//cout<<"\nSajay kumar";
}
void cih(char *pt,char *kv,int val){
char *plain,*key,*cyh;
plain=pt;
key=kv;
int pasc[50],kasc[50],i,xor[50],mul[50];
for(i=0;i<val;i++){
pasc[i]=plain[i];
kasc[i]=key[i];
xor[i]=pasc[i]^kasc[i];
cout<<pasc[i]<<"\t"<<kasc[i]<<"\t"<<xor[i]<<"\n";
mul[i]=xor[i]/26;
xor[i]=xor[i]%26;
xor[i]=xor[i]+97;
cyh[i]=xor[i];
}
cout<<"\nCipher Text Will be: ";
for(i=0;i<val;i++){
cout<<cyh[i]; //printing cypher Text
}
cout<<"\nDecrypted Text will be:";
//mul[] stores the queotent
char *dcyh;
int dval[50];
for(i=0;i<val;i++){
dval[i]=26*mul[i]+xor[i]-97; //generating original xor value
dval[i]=dval[i]^kasc[i]; //generating plain text ascii value
dcyh[i]=dval[i]; //Getting original text character
cout<<dcyh[i]; //printing original text
}
}
Vernam Ciphering In C++ ~ Programming Minds >>>>> Download Now
ReplyDelete>>>>> Download Full
Vernam Ciphering In C++ ~ Programming Minds >>>>> Download LINK
>>>>> Download Now
Vernam Ciphering In C++ ~ Programming Minds >>>>> Download Full
>>>>> Download LINK 93