Library/Library.Test/TestHashDerivedBytes.cs
C# | Copy Code |
---|---|
using (IPasswordDerivedBytes pd = DerivedBytes(TEST_PASSWORD)) { Assert.AreEqual(DefaultSalt.ToArray(), pd.Salt); byte[] bytes = pd.GetBytes(4); pd.Salt = new Salt().ToArray(); Assert.AreNotEqual(bytes, pd.GetBytes(bytes.Length)); Assert.AreNotEqual(DefaultSalt.ToArray(), pd.Salt); pd.Salt = DefaultSalt.ToArray(); Assert.AreEqual(bytes, pd.GetBytes(bytes.Length)); Assert.AreEqual(DefaultSalt.ToArray(), pd.Salt); } |
VB.NET | Copy Code |
---|---|
Using pd As IPasswordDerivedBytes = DerivedBytes(TEST_PASSWORD) Assert.AreEqual(DefaultSalt.ToArray(), pd.Salt) Dim bytes As Byte() = pd.GetBytes(4) pd.Salt = New Salt().ToArray() Assert.AreNotEqual(bytes, pd.GetBytes(bytes.Length)) Assert.AreNotEqual(DefaultSalt.ToArray(), pd.Salt) pd.Salt = DefaultSalt.ToArray() Assert.AreEqual(bytes, pd.GetBytes(bytes.Length)) Assert.AreEqual(DefaultSalt.ToArray(), pd.Salt) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7