Aplikasi Kriptografi Menggunakan Visual Basic 6
Aplikasi Kriptografi Menggunakan Visual Basic 6
Else
End If
d = Asc(Mid(UCase(kunci.Text), c, 1))
e = b - (d - 65)
If e < 65 Then
g = 91 - (65 - e)
Else
g=e
End If
f = Chr(g)
c=c+1
Else
f = Chr(b)
End If
Text1.Text = Text1.Text + f
If LCase(hasil.Text) = hasil.Text Then
Text1.Text = LCase(Text1.Text)
Else
End If
Next i
End Sub
Private Sub Command1_Click()
On Error Resume Next
hasil.Text = ""
a = Len(chiper.Text)
c=1
For i = 1 To a
b = Asc(Mid(UCase(chiper.Text), i, 1))
If b > 64 And b < 123 Then
If c > Len(kunci.Text) Then
Do
c=c-1
Loop Until c = 1
Else
End If
d = Asc(Mid(UCase(kunci.Text), c, 1))
e = b - (d - 65)
If e < 65 Then
g = 91 - (65 - e)
Else
g=e
End If
f = Chr(g)
c=c+1
Else
f = Chr(b)
End If
hasil.Text = hasil.Text + f
If LCase(chiper.Text) = chiper.Text Then
Text1.Text = LCase(Text1.Text)
Else
End If
Next i
End Sub
hasil.Text = LCase(hasil.Text)
Else
End If
Next i
Call dekrip
End Sub
Private Sub Command3_Click()
hasil.Text = ""
kunci.Text = ""
chiper.Text = ""
End Sub
Adovigenere.Refresh
data = Adovigenere.Recordset.Fields(IndexAscii)
End If
If j = panjangkunci Then
j=1
Else
j=j+1
End If
sandi = sandi +data
Next I
txtcipher.Text = sandi
End Sub
Private Sub txtkunci_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Private Sub txtplain_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Sehingga jika dirun hasilnya seperti berikut :
1 # include <stdio.h>
02
# include <conio.h>
03 # include <string.h>
04
05 int main(){
06
07
char keyword[100];
char msg[100];
08
int crypted;
09
int real_difference;
10
int i, k, l;
11
12
13
14
15
16
gets(msg);
17
18
19
k = strlen(keyword);
l = strlen(msg);
20
21
22
23
24
25
26
27
28
29
printf("\n\n");
for ( i = 0; i <= strlen(msg); i++){
keyword[i] -= 'a' - 1;
if ( (msg[i] + keyword[i]) > 'z'){
30
31
32
33
34
35
else {
36
37
38
39
printf("%c", crypted);
40
if ( i >= strlen(msg))break;
41
42
43
return 0;
getch();
44 }