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

Glossary Item Box

returns the total length of the salt in bytes

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Length As Integer
C# 
public int Length {get;}

Example

Library/Library.Test/TestSalt.cs

C#Copy Code
Salt s = new Salt();
byte[] bytes = new byte[s.Length];
s.CopyTo(bytes, 0);
Assert.AreEqual(s.ToArray(), bytes);
Assert.AreEqual(s.GetHashCode(), Salt.FromBytes(bytes).GetHashCode());

Salt strcpy = Salt.FromString(s.ToString());
Assert.AreEqual(s.ToArray(), strcpy.ToArray());
Assert.AreEqual(s.ToString(), strcpy.ToString());
Assert.AreEqual(s.GetHashCode(), strcpy.GetHashCode());
VB.NETCopy Code
Dim s As New Salt()
Dim bytes As Byte() = New Byte(s.Length) {}
s.CopyTo(bytes, 0)
Assert.AreEqual(s.ToArray(), bytes)
Assert.AreEqual(s.GetHashCode(), Salt.FromBytes(bytes).GetHashCode())

Dim strcpy As Salt = Salt.FromString(s.ToString())
Assert.AreEqual(s.ToArray(), strcpy.ToArray())
Assert.AreEqual(s.ToString(), strcpy.ToString())
Assert.AreEqual(s.GetHashCode(), strcpy.GetHashCode())

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys