Mono-Alphabetic Encryption

Ram Pothuraju
This program is for implementing MONOALPHABETIC encryption . 


MONOALPHABETIC:

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
char *ciper,*plan,*plan2;
clrscr();
puts("\nEnter the sender side text : ");
gets(plan);
puts("\nEnter the Charter difference : ");
scanf("%d",&n);
for(i=0;plan[i]!='\0';i++)
{
if((plan[i]>=65 && plan[i]<=90-n) || (plan[i]>=97 && plan[i]<=122-n))
            ciper[i]=plan[i]+n;
else if((plan[i]>90-n && plan[i]<=90)||(plan[i]>122-n && plan[i]<=122))
            ciper[i]=plan[i]-26+n;
else
            ciper[i]=plan[i];
}
ciper[i]='\0';
puts("\nThe trasmitted data is  : \n");
puts(ciper);

for(i=0;ciper[i]!='\0';i++)
{
if((ciper[i]>=65+n && ciper[i]<=90) || (ciper[i]>=97+n && ciper[i]<=122))
            plan2[i]=ciper[i]-n;
else if((ciper[i]>=65 && ciper[i]<=65+n)||(ciper[i]>=97 && ciper[i]<=97+n))
            plan2[i]=ciper[i]+26-n;
else
            plan2[i]=ciper[i];
}
plan2[i]='\0';
puts("\nThe Reciver side data is  : \n");
puts(plan2);

getch();
}


Post a Comment

0Comments

Post a Comment (0)