Bjr je voudré savoir comen haké un conte msn c pour fer pur a un copin c pa pour le hacké mrci
Rolf, Je suis désolé je n'ai pas pu résister à cette envie ^^'
Bon alors mon vrai problème est que j'ai trouvé une algorithme de cryptage en C# et je voudrais le convertir en VB.net, je l'ai fait mais il reste un problème, le cryptage ne se fait pas comme il devrait se faire :s
Alors voici le code en C# :
public static string Crypt(string Key, string Password)
{
char[] HASH = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'};
string _Crypted = "1";
for (int i = 0; i < Password.Length; i++)
{
char PPass = Password[i];
char PKey = Key[i];
int APass = (int)PPass / 16;
int AKey = (int)PPass % 16;
int ANB = (APass + (int)PKey) % HASH.Length;
int ANB2 = (AKey + (int)PKey) % HASH.Length;
_Crypted += HASH[ANB];
_Crypted += HASH[ANB2];
}
return _Crypted;
}
Et voici ce que j'ai fait en VB.net (qui marche mal)
Private Function crypt(ByVal key As String, ByVal password As String) As String
Dim crypted As String = "1"
Dim hash() As Char = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "-", "_"}
If password > key Then Return ("ERROR")
For i As Integer = 0 To password.Length - 1
Dim PPass As Char = password.Substring(i, 1)
Dim Pkey As Char = key.Substring(i, 1)
'Dim PPass As Char = password.Substring(i)
'Dim Pkey As Char = key.Substring(i)
'char PPass = Password[i];
'char PKey = Key[i];
Dim APass = (Asc(PPass) / 16)
'int APass = (int)PPass / 16;
Dim Akey = (Asc(PPass) Mod 16)
' int AKey = (int)PPass % 16
Dim ANB As Integer = (APass + (Asc(Pkey)) Mod hash.Length)
Dim ANB2 As Integer = (Akey + (Asc(Pkey)) Mod hash.Length)
If ANB > 63 Then ANB = ANB - 64
If ANB2 > 63 Then ANB2 = ANB2 - 64
crypted = crypted + hash(ANB)
crypted = crypted + hash(ANB2)
'int ANB = (APass + (int)PKey) % HASH.Length;
'int ANB2 = (AKey + (int)PKey) % HASH.Length;
' _Crypted += HASH[ANB];
' _Crypted += HASH[ANB2];
Next
Return (crypted)
End Function
Je pense que le problème se situe au niveau de ANB mais je n'ai pas réussi a le résoudre
Je vous remercie d'avance pour votre aide :)
Afficher la suite