[Algo] changer code VB.net en VB6

juju hack Messages postés 6 Date d'inscription lundi 23 janvier 2006 Statut Membre Dernière intervention 30 juillet 2008 - 30 juil. 2008 à 02:26
NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 - 30 juil. 2008 à 10:54
Voila je voulais savoir si il étais possible de changer ce petit code VB.net en
VB6 :

PublicFunction CryptPassword(ByVal Key AsString, ByVal Password AsString) AsString
Dim HASH AsChar() = {"a"C, "b"C, "c"C, "d"C, "e"C, "f"C, _
"g"C, "h"C, "i"C, "j"C, "k"C, "l"C, _
"m"C, "n"C, "o"C, "p"C, "q"C, "r"C, _
"s"C, "t"C, "u"C, "v"C, "w"C, "x"C, _
"y"C, "z"C, "A"C, "B"C, "C"C, "D"C, _
"E"C, "F"C, "G"C, "H"C, "I"C, "J"C, _
"K"C, "L"C, "M"C, "N"C, "O"C, "P"C, _
"Q"C, "R"C, "S"C, "T"C, "U"C, "V"C, _
"W"C, "X"C, "Y"C, "Z"C, "0"C, "1"C, _
"2"C, "3"C, "4"C, "5"C, "6"C, "7"C, _
"8"C, "9"C, "-"C, "_"C}
Dim _Crypted AsString = "#1"
Dim i AsInteger = 0
While i < Password.Length
Dim PPass AsChar = Password(i)
Dim PKey AsChar = Key(i)
Dim APass AsInteger = DirectCast(PPass, Integer) / 16
Dim AKey AsInteger = DirectCast(PPass, Integer) Mod 16
Dim ANB AsInteger = (APass + DirectCast(PKey, Integer)) Mod HASH.Length
Dim ANB2 AsInteger = (AKey + DirectCast(PKey, Integer)) Mod HASH.Length
_Crypted += HASH(ANB)
_Crypted += HASH(ANB2)
System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
EndWhile
Return _Crypted
EndFunction

En vous remercients :)

2 réponses

Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
30 juil. 2008 à 06:21
oui...

qu'est-ce qui en fait un code .Net plutot que VB6 ?
quelques bribes syntaxiquement differentes...

rien de bloquant
0
NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
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

Pour le Asc, pas sûr, mais bon ...

http://nhen0039.chez-alice.fr/index.php
0
Rejoignez-nous