CSharpTest.Net
CombineStream Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > SaltedData Class : CombineStream Method

salt
data

Glossary Item Box

Returns a stream that combines the salt and data

Syntax

Visual Basic (Declaration) 
Public Shared Function CombineStream( _
   ByVal salt As Salt, _
   ByVal data As Stream _
) As Stream
C# 
public static Stream CombineStream( 
   Salt salt,
   Stream data
)

Parameters

salt
data

Example

Library/Library.Test/TestSalt.cs

C#Copy Code
Salt s = new Salt(Salt.Size.b64);
byte[] testData = new byte[8];

byte[] test1 = new SaltedData(s, testData).ToArray();
Assert.AreEqual(16, test1.Length);
byte[] test2 = IOStream.ReadAllBytes(new SaltedData(s, testData).ToStream());
Assert.AreEqual(16, test2.Length);
byte[] test3 = IOStream.ReadAllBytes(SaltedData.CombineStream(s, new MemoryStream(testData)));
Assert.AreEqual(16, test3.Length);

Assert.AreEqual(test1, test2);
Assert.AreEqual(test1, test3);
Assert.AreEqual(test2, test3);
VB.NETCopy Code
Dim s As New Salt(Salt.Size.b64)
Dim testData As Byte() = New Byte(8) {}

Dim test1 As Byte() = New SaltedData(s, testData).ToArray()
Assert.AreEqual(16, test1.Length)
Dim test2 As Byte() = IOStream.ReadAllBytes(New SaltedData(s, testData).ToStream())
Assert.AreEqual(16, test2.Length)
Dim test3 As Byte() = IOStream.ReadAllBytes(SaltedData.CombineStream(s, New MemoryStream(testData)))
Assert.AreEqual(16, test3.Length)

Assert.AreEqual(test1, test2)
Assert.AreEqual(test1, test3)
Assert.AreEqual(test2, test3)

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys