Jumat, 12 November 2010

Enkripsi Dengan VB

Buatlah sebuah project yang terdiri dari 1 label, 2 textbox dan 1 commandbutton
masukan kode enkripsi dibawah ini

Function EncryptText(strText, ByVal strPwd)
Dim a, b
Dim strBuff
If strPwd <> “” And strText <> “” Then
strPwd = UCase(strPwd)
If Len(strPwd) Then
For a = 1 To Len(strText)
b = Asc(Mid(strText, i, 1))
b = b + Asc(Mid(strPwd, (a Mod Len(strPwd)) + 1, 1))
strBuff = strBuff & Chr(b And &HFF)
Next
Else
strBuff = strText
End If
EncryptText = strBuff
Else
EncryptText = “”
End If
End Function

Private Sub Command1_Click()
Text1.Text = EncryptText(Text1.Text, Text2.Text)
End Sub

jalankan program, dan masukan kata yang ingin dienkripsi pada text1 dan password pada text2.
lihat hasilnya...........

CopyRyght@2012 | Facebook | Twitte | Bloger | Google