Affine şifreleme yöntemi ile şifrelenmiş yazıyı deşifre eden program. Programda şifrelenmiş bir yazı var. 2 tane anahtar giriyorsunuz ve size çıktısını veriyor. Doğru anahtarları girerseniz orijinal yazıyı bulursunuz.
#include <stdio.h>
int main(void)
{
char a[198]={'K','Q','E','R','E','J','E','B','C','P','P','C', 'J','C','R','K','I','E','A','C','U','Z','B','K','R ','V','P','K','R',
'B','C','I','B','Q','C','A','R','B','J','C','V','F ','C','U','P',
'K','R','I','O','F','K','P','A','C','U','Z','Q','E ','P','B','K','R','X','P','E','I','I','E','A','B', 'D','K','P','B','C','P','F','C',
'D','C','C','A','F','I','E','A','B','D','K','P','B ','C','P','F','E','Q','P','K','A','Z','B','K','R',
'H','A','I','B','K','A','P','C','C','I','B','U','R ','C','C','D','K','D','C','C','J','C','I','D','F', 'U','I','X','P','A','F','F','E','R',
'B','I','C','Z','D','F','K','A','B','I','C','B','B ','E','N','E','F','C','U','P','J','C','V','K',
'A','B','P','C','Y','D','C','C','D','P','K','B','C ','O','C','P','E','R','K','I','V','K','S','C','P', 'I','C','B','R','K','I','J','P',
'K','A','B','I'},orntxt[198];
int i=0,j=0,d,b,sayi[198],orn[198],h;
for(i=0;i<198;i++)
sayi=a-'A'+1;
scanf("%d%d",&d,&b);
for(i=0;i<198;i++)
{
orn=(sayi-b);
if(orn<=0)
orn=orn+26;
for(j=1;j<27;j++)
for(h=1;h<27;h++)
if(orn*j==d*h)
{
orn=(orn*j)/d;
h=30;
j=30;
}
}
for(i=0;i<50;i++)
if(orn>26)
orn=orn-26;
for(i=0;i<50;i++)
if(orn<=0)
orn=orn+26;
for(i=0;i<198;i++)
orntxt='A'+(orn-1);
for(i=0;i<198;i++)
printf("%c",orntxt);
printf("\n");
return 0;
}
#include <stdio.h>
int main(void)
{
char a[198]={'K','Q','E','R','E','J','E','B','C','P','P','C', 'J','C','R','K','I','E','A','C','U','Z','B','K','R ','V','P','K','R',
'B','C','I','B','Q','C','A','R','B','J','C','V','F ','C','U','P',
'K','R','I','O','F','K','P','A','C','U','Z','Q','E ','P','B','K','R','X','P','E','I','I','E','A','B', 'D','K','P','B','C','P','F','C',
'D','C','C','A','F','I','E','A','B','D','K','P','B ','C','P','F','E','Q','P','K','A','Z','B','K','R',
'H','A','I','B','K','A','P','C','C','I','B','U','R ','C','C','D','K','D','C','C','J','C','I','D','F', 'U','I','X','P','A','F','F','E','R',
'B','I','C','Z','D','F','K','A','B','I','C','B','B ','E','N','E','F','C','U','P','J','C','V','K',
'A','B','P','C','Y','D','C','C','D','P','K','B','C ','O','C','P','E','R','K','I','V','K','S','C','P', 'I','C','B','R','K','I','J','P',
'K','A','B','I'},orntxt[198];
int i=0,j=0,d,b,sayi[198],orn[198],h;
for(i=0;i<198;i++)
sayi=a-'A'+1;
scanf("%d%d",&d,&b);
for(i=0;i<198;i++)
{
orn=(sayi-b);
if(orn<=0)
orn=orn+26;
for(j=1;j<27;j++)
for(h=1;h<27;h++)
if(orn*j==d*h)
{
orn=(orn*j)/d;
h=30;
j=30;
}
}
for(i=0;i<50;i++)
if(orn>26)
orn=orn-26;
for(i=0;i<50;i++)
if(orn<=0)
orn=orn+26;
for(i=0;i<198;i++)
orntxt='A'+(orn-1);
for(i=0;i<198;i++)
printf("%c",orntxt);
printf("\n");
return 0;
}