===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int i,x,y,n=0,j,k,q;
char c,a[100],b[100];
gotoxy(38,1);
cprintf("MENU");
gotoxy(38,2);
cprintf("ÄÄÄÄ");
gotoxy(34,4);
cprintf("¯");
textcolor(YELLOW+BLINK);
cprintf(" Encryption");
gotoxy(34,5);
textcolor(WHITE);
cprintf("¯ Decryption");
for(i=0;n==0;i++)
{
if(i%2==0)
{
c=getch();
if(c==13)
{
n=1;
break;
}
else
{
gotoxy(36,4);
textcolor(WHITE);
cprintf("Encryption");
gotoxy(36,5);
textcolor(YELLOW+BLINK);
cprintf("Decryption");
}
}
else
{
c=getch();
if(c==13)
{
n=2;
break;
}
else
{
gotoxy(36,4);
textcolor(YELLOW+BLINK);
cprintf("Encryption");
gotoxy(36,5);
textcolor(WHITE);
cprintf("Decryption");
}
}
}
textcolor(WHITE);
/*
gotoxy(30,11);
cprintf("Enter Name of File: ");
cin>>c;*/
gotoxy(30,11);
cprintf("Enter CODE: ");
gets(b);
gotoxy(30,13);
cprintf("Enter \"X\" Pin: ( Don't Include 7,8,9,10 )");
gotoxy(45,13);
cscanf("%d",&x);
gotoxy(30,15);
cprintf("Enter \"Y\" Pin: ( Don't Include 7,8,9,10 )");
gotoxy(45,15);
cscanf("%d",&y);
clrscr();
gotoxy(3,3);
textcolor(5);
cprintf("Translating Your Code. Wait for a Hot sec. ");
for(i=1;i<=50;i++)
{
sound(i*50);
textcolor(i);
if(i%2==0)
cprintf("\b\\");
else
cprintf("\b\/");
delay(200);
}
textcolor(WHITE);
nosound();
clrscr();
switch(n)
{
case 1:
for(i=1,k=2;b[k-2]!='\0';i+=2,k++)
{
q=b[k-2]*x-(k+5)*y;
a[i]=q;
for(j=1;q>=256;j++)
q-=256;
a[i-1]=j;
if(q==13 || q==8 || q==9 || q==10)
{
a[i-1]=48;
a[i+1]=a[i]+6;
a[i]=j;
i++;
}
}
a[i-1]='\0';
break;
case 2:
for(i=1,j=1;b[i-1]!='\0';i+=2,j++)
{
q=b[i];
if(b[i]==48)
{
i+=2;
q=b[i];
q=q-6;
}
if(q<0)
q=b[i]+256;
a[i-j]=(q+256*(b[i-1]-1)+(j+6)*y)/x;
}
a[i-j]='\0';
break;
}
gotoxy(3,3);
cprintf("Your Code:-");
gotoxy(3,4);
cprintf("ÄÄÄÄÄÄÄÄÄ");
gotoxy(3,5);
for(i=0;a[i]!='\0';i++)
cprintf("%c",a[i]);
c=getch();
c=getch();
gotoxy(3,6);
if(c==' ')
{
cprintf("\r\n");
for(i=0;a[i]!='\0';i++)
{
if((int)a[i]<0)
cprintf("%d ",(int)(a[i]+256));
else
cprintf("%d ",(int)a[i]);
}
getch();
}
}
CODING
#include<all.h>
void main()
{
clrscr();
int i,x,y,n=0,j,k,q;
char c,a[100],b[100];
gotoxy(38,1);
cprintf("MENU");
gotoxy(38,2);
cprintf("ÄÄÄÄ");
gotoxy(34,4);
cprintf("¯");
textcolor(YELLOW+BLINK);
cprintf(" Encryption");
gotoxy(34,5);
textcolor(WHITE);
cprintf("¯ Decryption");
for(i=0;n==0;i++)
{
if(i%2==0)
{
c=getch();
if(c==13)
{
n=1;
break;
}
else
{
gotoxy(36,4);
textcolor(WHITE);
cprintf("Encryption");
gotoxy(36,5);
textcolor(YELLOW+BLINK);
cprintf("Decryption");
}
}
else
{
c=getch();
if(c==13)
{
n=2;
break;
}
else
{
gotoxy(36,4);
textcolor(YELLOW+BLINK);
cprintf("Encryption");
gotoxy(36,5);
textcolor(WHITE);
cprintf("Decryption");
}
}
}
textcolor(WHITE);
/*
gotoxy(30,11);
cprintf("Enter Name of File: ");
cin>>c;*/
gotoxy(30,11);
cprintf("Enter CODE: ");
gets(b);
gotoxy(30,13);
cprintf("Enter \"X\" Pin: ( Don't Include 7,8,9,10 )");
gotoxy(45,13);
cscanf("%d",&x);
gotoxy(30,15);
cprintf("Enter \"Y\" Pin: ( Don't Include 7,8,9,10 )");
gotoxy(45,15);
cscanf("%d",&y);
clrscr();
gotoxy(3,3);
textcolor(5);
cprintf("Translating Your Code. Wait for a Hot sec. ");
for(i=1;i<=50;i++)
{
sound(i*50);
textcolor(i);
if(i%2==0)
cprintf("\b\\");
else
cprintf("\b\/");
delay(200);
}
textcolor(WHITE);
nosound();
clrscr();
switch(n)
{
case 1:
for(i=1,k=2;b[k-2]!='\0';i+=2,k++)
{
q=b[k-2]*x-(k+5)*y;
a[i]=q;
for(j=1;q>=256;j++)
q-=256;
a[i-1]=j;
if(q==13 || q==8 || q==9 || q==10)
{
a[i-1]=48;
a[i+1]=a[i]+6;
a[i]=j;
i++;
}
}
a[i-1]='\0';
break;
case 2:
for(i=1,j=1;b[i-1]!='\0';i+=2,j++)
{
q=b[i];
if(b[i]==48)
{
i+=2;
q=b[i];
q=q-6;
}
if(q<0)
q=b[i]+256;
a[i-j]=(q+256*(b[i-1]-1)+(j+6)*y)/x;
}
a[i-j]='\0';
break;
}
gotoxy(3,3);
cprintf("Your Code:-");
gotoxy(3,4);
cprintf("ÄÄÄÄÄÄÄÄÄ");
gotoxy(3,5);
for(i=0;a[i]!='\0';i++)
cprintf("%c",a[i]);
c=getch();
c=getch();
gotoxy(3,6);
if(c==' ')
{
cprintf("\r\n");
for(i=0;a[i]!='\0';i++)
{
if((int)a[i]<0)
cprintf("%d ",(int)(a[i]+256));
else
cprintf("%d ",(int)a[i]);
}
getch();
}
}
===========================================================================
No comments:
Post a Comment