Sisyboy’s Weblog

Just another WordPress.com weblog

PROGRAM HILLS

#include<stdio.h>
#include<string.h>

main(){
int i,j,k,l,p, m, pilih, a,c, b,d, s1,s2,y1,y2;
char temp, sistem;
char z[40],key[40],hasil[40], A, B;
char huruf[26]={‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,
‘N’,’O’,’P’,’Q’,’R’,’S’,’T’,’U’,’V’,’W’,’X’,’Y’,’Z’};

clrscr();

printf(” ==========================================================\n”);
printf(” = PROGRAM HILSS =\n”);
printf(” = =\n”);
printf(” = Neo Fajar Bawana Konta Dewa Danu =\n”);
printf(” = TEKNIK PERSANDIAN =\n”);
printf(” = =\n”);
printf(” ==========================================================\n”);
printf(“\n”);
sleep(2);
clrscr();
printf(” ___________________________________________________________\n”);
printf(“| |\n”);
printf(“| SELAMAT DATANG DI PROGRAM PENYANDIAN HILSS |\n”);
printf(“| 1. ENCRYPTION |\n”);
printf(“| 2. DECRYPTION |\n”);
printf(“| 3. EXIT |\n”);
printf(“|__________________________________________________________|\n”);
printf(“\n”);
printf(” masukkan menu pilihan anda:”);
scanf(“%d”,&pilih);
switch(pilih);
{
case1:
clrscr();
printf(” ====Selamat Datang di Program Digraf Encryption====\n “);
sleep(2);
printf(“\n”);
printf(“A.Sistem KS\n”);
printf(“B.Sistem KCTR\n”);
printf(“Pilih Sistem Sandi Yang Akan digunakan:\n”);
scanf(“%c”, &sistem);
switch(sistem);
{
case’A’:
printf(“ENTER KEY WORD (UPPER CASE LETTER) : “);
scanf(“%s”,key);
l = strlen(key);

for(i=0;i<l;i++)
for(j=i+1;j<l;j++){
if(key[i] == key[j]){
key[j]=’ ‘;
if(j+1<l){
m=j;
for(k=m+1;k<l;k++){
key[m]=key[k];
m++;
}
j–;
}
l-=1;
}
}

for(i=0;i<26;i++)
for(j=0;j<l;j++){
if(huruf[i]==key[j])
huruf[i]=’ ‘;
}

p = l;
for(i=0;i<26;i++){
if(huruf[i]!=’ ‘){
key[p]=huruf[i];
p++;
}
}
clrscr();
printf(“\n\n”);
printf(“HASIL PROSES KS: \n”);
printf(“\n”);

for(i=0;i<26;i++){
printf(“%c”,key[i]);
}

sleep(1);
printf(“\n\n”);
printf(“untuk persamaan y1\n”);
sleep(1);
printf(“masukkan nilai koefisien x1:”);
scanf(“%d”,&a);
printf(“\n”);
printf(“masukkan nilai koefisien x2:”);
scanf(“%d”,&b);
printf(“\n”);
printf(“masukkan nilai konstanta1:”);
scanf(“%d”,&s1);
printf(“\n”);
printf(“untuk persamaan y2”);
sleep(1);
printf(“\n”);
printf(“masukkan nilai koefisien x1:”);
scanf(“%d”,&c);
printf(“\n”);
printf(“masukkan nilai koefisien x2:”);
scanf(“%d”,&d);
printf(“\n”);
printf(“masukkan nilai konstanta2:”);
scanf(“%d”,&s2);
printf(“\n”);

for(i=0,j=i+1;i,j<26;i++,j++)
{
key[i]=key[i+1];
y1=(i*a+j*b+s1)%26;
y2=(i*c+j*d+s2)%26;
printf(“%c%c “, key[y1],key[y2]);}
break;

case’B’:
printf(“copy cepet”);
break;
}

case2:
printf(“maaf saya belum mengerti jadi maaf”);
break;
case3:
break;
}
getch();

}

Advertisements

May 6, 2008 - Posted by | Pemrograman Neo

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: