Visual Basic (Declaration) | |
---|---|
Public Function New() |
C# | |
---|---|
public Salt() |
Library/Library.Test/TestSalt.cs
C# | Copy Code |
---|---|
Salt s = new Salt(); byte[] testData = new byte[8]; new Random().NextBytes(testData); byte[] tmp; using (SaltedData sd = new SaltedData(s, testData)) { Assert.AreEqual(40, sd.Length); Assert.AreEqual(s, sd.Salt); Assert.AreEqual(testData, sd.GetDataBytes()); tmp = sd.ToArray(); Assert.AreEqual(40, tmp.Length); Assert.AreEqual(tmp, IOStream.ReadAllBytes(sd.ToStream())); } using (SaltedData sd = new SaltedData(tmp)) { Assert.AreEqual(s, sd.Salt); Assert.AreEqual(testData, sd.GetDataBytes()); Assert.AreEqual(tmp, sd.ToArray()); } using (SaltedData sd = new SaltedData(new MemoryStream(tmp))) { Assert.AreEqual(s, sd.Salt); Assert.AreEqual(testData, sd.GetDataBytes()); Assert.AreEqual(tmp, sd.ToArray()); } |
VB.NET | Copy Code |
---|---|
Dim s As New Salt() Dim testData As Byte() = New Byte(8) {} New Random().NextBytes(testData) Dim tmp As Byte() Using sd As New SaltedData(s, testData) Assert.AreEqual(40, sd.Length) Assert.AreEqual(s, sd.Salt) Assert.AreEqual(testData, sd.GetDataBytes()) tmp = sd.ToArray() Assert.AreEqual(40, tmp.Length) Assert.AreEqual(tmp, IOStream.ReadAllBytes(sd.ToStream())) End Using Using sd As New SaltedData(tmp) Assert.AreEqual(s, sd.Salt) Assert.AreEqual(testData, sd.GetDataBytes()) Assert.AreEqual(tmp, sd.ToArray()) End Using Using sd As New SaltedData(New MemoryStream(tmp)) Assert.AreEqual(s, sd.Salt) Assert.AreEqual(testData, sd.GetDataBytes()) Assert.AreEqual(tmp, sd.ToArray()) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
Salt ClassSalt Members
Overload List