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

Glossary Item Box

Sets or Gets the salt used with deriving the encryption key

Syntax

Visual Basic (Declaration) 
Public Overridable Property Salt As Salt
C# 
public virtual Salt Salt {get; set;}

Example

Library/Library.Test/TestPassword.cs

C#Copy Code
PasswordKey pk1 = new PasswordKey(TEST_PASSWORD);
PasswordKey pk2 = new PasswordKey(TEST_PASSWORD);
pk2.Salt = pk1.Salt;
Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
pk2.IterationCount /= 2;
Assert.AreEqual(pk1.Salt, pk2.Salt);
Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
VB.NETCopy Code
Dim pk1 As New PasswordKey(TEST_PASSWORD)
Dim pk2 As New PasswordKey(TEST_PASSWORD)
pk2.Salt = pk1.Salt
Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key)
pk2.IterationCount /= 2
Assert.AreEqual(pk1.Salt, pk2.Salt)
Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key)

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys