public byte[] Read(int size) { byte[] numArray = new byte[size]; for (int i = 0; i < size; i++) { if (this.used == (int)this.data.Length) { this.Process(); } byte[] numArray1 = this.data; WowAuthCrypto.CryptoRandom cryptoRandom = this; int num = cryptoRandom.used; int num1 = num; cryptoRandom.used = num + 1; numArray[i] = numArray1[num1]; } return(numArray); }
public static byte[] MakeSessionKey(byte[] clientSecret, byte[] joinSecret, byte[] clientChallenge, byte[] userRouterChallenge) { SHA256 sHA = new SHA256CryptoServiceProvider(); byte[] array = sHA.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { clientSecret, joinSecret })); HMACSHA256 hMACSHA = new HMACSHA256(array); byte[] seed = hMACSHA.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { userRouterChallenge, clientChallenge, WowAuthCrypto.MAKE_SESSION_KEY_TAG })); WowAuthCrypto.CryptoRandom cryptoRandom = new WowAuthCrypto.CryptoRandom(seed); return(cryptoRandom.Read(40)); }