This is the code, some word has type in Bahasa Indonesia language. I hope it doesn't make you struggling.
#include
the code will appear like this, enjoy it. Thanks.
#include
#include
#include
int main()
{
/*Kamus*/
//char terkait dengan isi dari karakter
char pt[100]={};
char k[100]={};
char key[100]={};
char mat[10][10]={};
char ct[100]={};
//int terkait dengan panjang dari karakter
int i=0;
int j=0;
int a=0;
int c=0;
int ctr;
int no[10]={0};
int z;
/*Algoritma*/
printf("Chiper Transposisi\n");
printf("ENCRYPT dan DECRYPT\n");
printf("\nInput plainteks tanpa spasi: \n");
gets(pt);
printf("\nMasukkan suatu kata sebagai key : \n");
gets(k);
strcpy(key,k);
strcat(k,pt);
strcpy(pt,k);
printf("\nMasukkan satu angka lalu enter \n");
printf("secara urut/tidak terurut\n");
printf("dari 0 sampai panjangkey-1 : \n");
for(i=0;i
{
scanf("%d",&no[i]);
}
j=0;
ctr=j;
printf("\n-------------------\n");
printf("Matriksnya dari key ");
printf("\n-------------------\n");
for(i=0;i
{
for(j=j;ctr
{
if(pt[j]!='\0')
{
mat[i][ctr]=pt[j];
printf("%c",mat[i][ctr]);
ctr++;
}
else
{
goto out;
}
}
ctr=0;
if(i==0)
{
printf("\n");
}
printf("\n");
}
out:
printf("\n\n---------------------\n");
printf("Hasil Enkripsi: \n");
printf("---------------------\n");
for(i=0;i
{
for(j=0;j
{
if(no[i]==j)
{
for(z=1;z<10 o:p="" z="">10>
{
if((mat[z][j]))
{
printf("%c",mat[z][j]);
ct[a]=mat[z][j];
a++;
}
}
}
}
}
printf("\n\n\n---------------------\n");
printf("Hasil Dekripsi: \n");
printf("---------------------\n");
for(a=0;a<30 a="" o:p="">30>
{
if((ct[a]) || (ct[a]))
c++;
}
for(i=1;i
{
for(j=0;j
{
if((mat[i][j]))
{
printf("%c",mat[i][j]);
}
else
{
printf("\n---------------------\n");
getch();
return 0;
}
}
}
}
the code will appear like this, enjoy it. Thanks.
Cryptography Transposition Cipher in C++
Reviewed by Izuka
on
Tuesday, October 01, 2013
Rating: