Encryption - Decryption program with VB

Encryption is the process of transforming information (referred to as plaintext) using an algorithm (called cipher) to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key.
The result of the process is encrypted information (in cryptography, referred to as ciphertext).
In here, we would shown sample program with application that displayed like the following:


















This program will be encrypted all words are input by user at textboxt text label. Then the output will be display at textboxt with label Hasil enkripsi and vice versa. The output of decryption will be display at textbox Hasil Deskripsi label.

The following is sample of main code:

Private Sub cmd_enkrip_Click()
Dim Enkrip, Output, Inputan As String
Dim Panjang_Input As Integer
Inputan = Text1.Text
Panjang_Input = Len(Text1.Text)
For i = 1 To Panjang_Input
Enkrip = Mid(Inputan, i, 1)
Enkrip = Asc(Enkrip)
Enkrip = (Enkrip + 5) - 13
Enkrip = Chr(Enkrip)
Output = Output & Enkrip
Next i
Text2.Text = Output
End Sub

Private Sub cmd_dekrip_Click()
Dim Dekrip, Output, Inputan As String
Dim Panjang_Input, Pesan As Integer
Inputan = Text3.Text
Panjang_Input = Len(Text3.Text)
For i = 1 To Panjang_Input
Dekrip = Mid(Inputan, i, 1)
Dekrip = Asc(Dekrip)
Dekrip = (Dekrip - 5) + 13
Dekrip = Chr(Dekrip)
Output = Output & Dekrip
Next i
Text4.Text = Output
End Sub

Private Sub cmd_hapus_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub

Private Sub Command3_Click()
End
End Sub

Comments

Leave a Reply

Awards

100 Blog Indonesia Terbaik


IP
Powered by Blogger.