CSharpTest.Net
GetData(Stream) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > Salt Class > GetData Method : GetData(Stream) Method

data

Glossary Item Box

Returns the salt combined with a copy of the speicified data as a stream

Syntax

Visual Basic (Declaration) 
Public Overloads Function GetData( _
   ByVal data As Stream _
) As SaltedData
C# 
public SaltedData GetData( 
   Stream data
)

Parameters

data

Example

Library/Library.Test/TestSalt.cs

C#Copy Code
Salt s = new Salt();
byte[] bytes = new byte[1024];
new Random().NextBytes(bytes);

SaltedData sd = s.GetData(bytes);
Assert.AreEqual(s, sd.Salt);
Assert.AreEqual(bytes, sd.GetDataBytes());

sd = s.GetData(new MemoryStream(bytes));
Assert.AreEqual(s, sd.Salt);
Assert.AreEqual(bytes, sd.GetDataBytes());
VB.NETCopy Code
Dim s As New Salt()
Dim bytes As Byte() = New Byte(1024) {}
New Random().NextBytes(bytes)

Dim sd As SaltedData = s.GetData(bytes)
Assert.AreEqual(s, sd.Salt)
Assert.AreEqual(bytes, sd.GetDataBytes())

sd = s.GetData(New MemoryStream(bytes))
Assert.AreEqual(s, sd.Salt)
Assert.AreEqual(bytes, sd.GetDataBytes())

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys