Library/Library.Test/TestHash.cs
C# | Copy Code |
---|---|
Hash hash = Hash.SHA512(TestData);
Assert.AreEqual(SHA512.Create().ComputeHash(TestData), hash.ToArray());
Hash hash2 = Hash.SHA512(TestDataStream());
Assert.AreEqual(hash, hash2);
Assert.IsTrue(hash == hash2);
Assert.IsTrue(hash.Equals(hash2));
Assert.IsTrue(hash.Equals((object)hash2));
Assert.AreEqual(hash.GetHashCode(), hash2.GetHashCode());
Assert.AreEqual(hash.Length, hash2.Length);
Assert.AreEqual(hash.ToString(), hash2.ToString());
Assert.AreEqual(hash.ToArray(), hash2.ToArray());
Assert.IsFalse(hash != hash2); |
VB.NET | Copy Code |
---|---|
Dim hash As Hash = Hash.SHA512(TestData) Assert.AreEqual(SHA512.Create().ComputeHash(TestData), hash.ToArray()) Dim hash2 As Hash = Hash.SHA512(TestDataStream()) Assert.AreEqual(hash, hash2) Assert.IsTrue(hash = hash2) Assert.IsTrue(hash.Equals(hash2)) Assert.IsTrue(hash.Equals(DirectCast(hash2, Object))) Assert.AreEqual(hash.GetHashCode(), hash2.GetHashCode()) Assert.AreEqual(hash.Length, hash2.Length) Assert.AreEqual(hash.ToString(), hash2.ToString()) Assert.AreEqual(hash.ToArray(), hash2.ToArray()) Assert.IsFalse(hash <> hash2) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7