این دوتا Function یکیشون Encrypt میکنه و دیگری Decrypt. 8-)
Private Function fDecrypt(ByVal strKey As String, ByVal strInput As String) As String
'--- Decrypts a string encrypted by fEncrypt
'--- Parameters
'strKey: the private key used to encrypt the string
'strInput: the encrypted string to decrypt
Dim intC1 As Integer
Dim lngKey As Long
Dim aintRVal() As Integer
Dim intTemp As Integer
If strKey = vbNullString Or _
strInput = vbNullString Then Exit Function
'Generate the encryption key value from strKey
For intC1 = 1 To Len(strKey)
lngKey = lngKey + Asc(Mid$(strKey, intC1, 1))
Next
'Seed the randomizer
Rnd (-1)
Randomize lngKey
'Generate a series of random numbers between
'32 and 159 for the chars in strInput
ReDim aintRVal(1 To Len(strInput))
For intC1 = 1 To Len(strInput)
aintRVal(intC1) = ((Rnd() * 127) + 1) Mod 223 + 32
Next
'Decrypt strInput
For intC1 = 1 To Len(strInput)
intTemp = ((Asc(Mid$(strInput, intC1, 1)) - aintRVal(intC1)) Mod 223) - 32
If intTemp < 0 Then intTemp = intTemp + 223
fDecrypt = fDecrypt & Chr$(intTemp)
Next
End Function
Private Function fEncrypt(ByVal strKey As String, ByVal strInput As String) As String
'--- Encrypts a string
'--- Parameters
'strKey: the private key used to encrypt the string
'strInput: the string to encrypt
Dim intC1 As Integer
Dim lngKey As Long
Dim aintRVal() As Integer
If strKey = vbNullString Or _
strInput = vbNullString Then Exit Function
'Generate the encryption key value from strKey
For intC1 = 1 To Len(strKey)
lngKey = lngKey + Asc(Mid$(strKey, intC1, 1))
Next
'Seed the randomizer
Rnd (-1)
Randomize lngKey
'Generate a series of random numbers between
'32 and 159 for the chars in strInput
ReDim aintRVal(1 To Len(strInput))
For intC1 = 1 To Len(strInput)
aintRVal(intC1) = ((Rnd() * 127) + 1) Mod 223 + 32
Next
'Encrypt strInput
For intC1 = 1 To Len(strInput)
fEncrypt = fEncrypt & _
Chr$(((Asc(Mid$(strInput, intC1, 1)) + aintRVal(intC1)) Mod 223) + 32)
Next
End Function