private byte[] SetServerHandshakeDigest2(byte[] c1, DigestPosition pos) { var hash = ComputeHandshakeDigest2(c1, pos, c1, GenuineFMSKey); Array.Copy(hash, 0, c1, c1.Length - 32, 32); return(c1); }
private byte[] ComputeHandshakeDigest2(byte[] keyvec, DigestPosition keypos, byte[] vec, byte[] key) { var doffset = GetDigestOffset(keyvec, keypos); var hasher1 = new System.Security.Cryptography.HMACSHA256(key); var key2 = hasher1.ComputeHash(keyvec, doffset, 32); var hasher2 = new System.Security.Cryptography.HMACSHA256(key2); return(hasher2.ComputeHash(vec, 0, vec.Length - 32)); }
private byte[] SetServerHandshakeDigest1(byte[] vec, DigestPosition pos) { var doffset = GetDigestOffset(vec, pos); var key = new byte[36]; Array.Copy(GenuineFMSKey, key, 36); var hash = ComputeHandshakeDigest1(vec, key, doffset); Array.Copy(hash, 0, vec, doffset, 32); return(vec); }
private int GetDigestOffset(byte[] vec, DigestPosition pos) { switch (pos) { case DigestPosition.First: return((vec[8] + vec[9] + vec[10] + vec[11]) % 728 + 12); case DigestPosition.Second: return((vec[772] + vec[773] + vec[774] + vec[775]) % 728 + 776); default: throw new ArgumentException(); } }
private bool ValidateClientHandshakeDigest2(byte[] vec, byte[] s1, DigestPosition pos) { var hash = ComputeHandshakeDigest2(s1, pos, vec, GenuineFPKey); return(Enumerable.Range(vec.Length - 32, 32).Select(i => vec[i]).SequenceEqual(hash)); }
private bool ValidateClientHandshakeDigest2(byte[] vec, byte[] s1, DigestPosition pos) { var hash = ComputeHandshakeDigest2(s1, pos, vec, GenuineFPKey); return Enumerable.Range(vec.Length-32, 32).Select(i => vec[i]).SequenceEqual(hash); }
private byte[] SetServerHandshakeDigest2(byte[] c1, DigestPosition pos) { var hash = ComputeHandshakeDigest2(c1, pos, c1, GenuineFMSKey); Array.Copy(hash, 0, c1, c1.Length-32, 32); return c1; }
private byte[] SetServerHandshakeDigest1(byte[] vec, DigestPosition pos) { var doffset = GetDigestOffset(vec, pos); var key = new byte[36]; Array.Copy(GenuineFMSKey, key, 36); var hash = ComputeHandshakeDigest1(vec, key, doffset); Array.Copy(hash, 0, vec, doffset, 32); return vec; }
private byte[] ComputeHandshakeDigest2(byte[] keyvec, DigestPosition keypos, byte[] vec, byte[] key) { var doffset = GetDigestOffset(keyvec, keypos); var hasher1 = new System.Security.Cryptography.HMACSHA256(key); var key2 = hasher1.ComputeHash(keyvec, doffset, 32); var hasher2 = new System.Security.Cryptography.HMACSHA256(key2); return hasher2.ComputeHash(vec, 0, vec.Length-32); }
private int GetDigestOffset(byte[] vec, DigestPosition pos) { switch (pos) { case DigestPosition.First: return (vec[8]+vec[9]+vec[10]+vec[11]) % 728 + 12; case DigestPosition.Second: return (vec[772]+vec[773]+vec[774]+vec[775]) % 728 + 776; default: throw new ArgumentException(); } }