NHenry
Messages postés15112Date d'inscriptionvendredi 14 mars 2003StatutModérateurDernière intervention13 avril 2024159 30 juil. 2008 à 10:54
Bonjour,
Public Function CryptPassword(ByVal Key As String, ByVal Password As String) As String
Dim HASH(0 to 63) As String
HASH(0)="a"
HASH(1)="b"
...
HASH(62)="-"
HASH(63)="_"
Dim _Crypted As String
_Crypted="#1"
Dim i As long = 0
Dim PPass As string
Dim PKey As string
Dim APass As long
Dim AKey As long
Dim ANB As long
Dim ANB2 As long
Do While i < Password.Length
PPass = mid$(Password,i,1)
pKey = mid$(Key,i,1)
APass = asc(PPass) / 16
AKey = asc(PPass) Mod 16
ANB = (APass + asc(PKey)) Mod ubound(HASH)+1
ANB2 = (AKey + asc(PKey)) Mod ubound(HASH)+1
_Crypted = _Crypted+ HASH(ANB)
_Crypted = _Crypted+ HASH(ANB2)
'Euh là je ne vois pas comment traduire
System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
loop
CryptPassword= _Crypted
End Function