-
Member
When hashing I:P and Compute K i use lowercase. Could be the problem ?
-
★ Elder ★
Originally Posted by
julienguillot
When hashing I:P and Compute K i use lowercase. Could be the problem ?
username & pw need a .ToUpper()
Last edited by doityourself; 07-31-2017 at 08:25 AM.
-
Member
-
Member
-
Member
Hello,
Is this algorithm is applicated to Wotlk ?
Password Proof (K)
This value is generated by the client and the server as proof that they actually know the value of S. This is another value which differs from standard SRP, which justs sends SHA1(S).
Blizzard's version calculates K as follows:
Place the even bytes of S into one buffer, and the odd bytes into another.
Create a SHA-1 hash of each buffer.
Create K by combining the even bytes of the first buffer, and the odd bytes of the second.
But.. it's exaclty what i'm doing :
public void CalculateK()
{
// Generation de S = (A * v^u) ^ b % N
BigInteger p1 = ClientPublicEphemeral * BigInteger.ModPow(Verifier, Scrambler, Modulus); // (A * v^u)
byte[] ss = BigInteger.ModPow(p1, ServerPrivateEphemeral, Modulus).ToByteArray();
SessionKeyRaw = MakeBigInteger(ss);
// Generation de K
byte[] t1 = new byte[16];
byte[] t2 = new byte[16];
byte[] vK = new byte[40];
for (int i = 0; i < 16; i++)
{
t1[i] = ss[i * 2];
t2[i] = ss[i * 2 + 1];
}
t1 = sha1.ComputeHash(t1, 0, 16);
t2 = sha1.ComputeHash(t1, 0, 16);
for (int i = 0; i < 20; i++)
{
vK[i * 2] = t1[i];
vK[i * 2 + 1] = t2[i];
}
SessionKeyHash = MakeBigInteger(vK);
}
Last edited by julienguillot; 08-02-2017 at 07:23 PM.
-
Contributor
Change
Code:
byte[] HI = sha1.ComputeHash(Encoding.UTF8.GetBytes(username.StringToHex())); //line 139 of the latest paste
to
Code:
byte[] HI = sha1.ComputeHash(Encoding.UTF8.GetBytes(username.toUpper()));
-
Post Thanks / Like - 1 Thanks
julienguillot (1 members gave Thanks to Glusk for this useful post)
-
Member
Hey Glusk, thank you for your answer.
I tried with .ToUpper() before set .StringToHex() but M is still not equal to M1...
-
Member
-
★ Elder ★
Maybe I can help you later again, but I have other wow related stuff todo now, sorry^^
-
Contributor
Could you please upload a working BigIntegerExtensions class with all its dependencies so that I can run your code. As it is, lines 368 and 461 have compile errors:
Line 368 uses an undefined method on a byte array, ToHexString():
Code:
return bigInt.ToUnsignedByteArray().ToHexString();
Line 461 misses a dependant class ByteExtensions:
Code:
return ByteExtensions.GenerateHashFor(bigInt.ToCleanByteArray());
-
Post Thanks / Like - 1 Thanks
julienguillot (1 members gave Thanks to Glusk for this useful post)
-
Member
Thank you dude but i found the problem and resolved it ! M and M1 are now always the same if password is correct.