Как зашифровать пароль?

DecryptedPassword - пароль для шифрования.


Function EncryptPassword(Number As Byte, DecryptedPassword As String) 
Dim Password As String, Counter As Byte 
Dim Temp As Integer 

Counter = 1 
Do Until Counter = Len(DecryptedPassword) + 1 
Temp = Asc(Mid(DecryptedPassword, Counter, 1)) 
If Counter Mod 2 = 0 Then 
'see if even 
Temp = Temp - Number 
Else 
Temp = Temp + Number 
End If 
Temp = Temp Xor (10 - Number) 
Password = Password & Chr$(Temp) 
Counter = Counter + 1 
Loop 
EncryptPassword = Password 
End Function 

Function DecryptPassword(Number As Byte, EncryptedPassword As String) 
Dim Password As String, Counter As Byte 
Dim Temp As Integer 

Counter = 1 
Do Until Counter = Len(EncryptedPassword) + 1 
Temp = Asc(Mid(EncryptedPassword, Counter, 1)) Xor (10 - Number) 
If Counter Mod 2 = 0 Then 'see if even 
Temp = Temp + Number 
Else 
Temp = Temp - Number 
End If 
Password = Password & Chr$(Temp) 
Counter = Counter + 1 
Loop 
DecryptPassword = Password 
End Function

Уж вызвать функции догадаешься? Если нет, то:

m_Security = EncryptPassword(Number, DecryptedPassword)

m_Security = DecryptPassword(Number, EncryptedPassword)


Hosted by uCoz