CSharpTest.Net
Salt Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > IPasswordDerivedBytes Interface : Salt Property

Glossary Item Box

Gets or sets the key salt value for the operation.

Syntax

Visual Basic (Declaration) 
Property Salt As Byte()
C# 
byte[] Salt {get; set;}

Example

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.NETCopy 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

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys