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

encodedBytes

Glossary Item Box

Creates a comparable Hash object from the base-64 encoded hashcode bytes

Syntax

Visual Basic (Declaration) 
Public Shared Function FromString( _
   ByVal encodedBytes As String _
) As Hash
C# 
public static Hash FromString( 
   string encodedBytes
)

Parameters

encodedBytes

Example

Library/Library.Test/TestHash.cs

C#Copy Code
Hash hash = Hash.MD5(TestData);
Hash copy = Hash.FromBytes(hash.ToArray());
Assert.AreEqual(hash, copy);
Assert.AreEqual(hash.ToString(), copy.ToString());

copy = Hash.FromString(hash.ToString());
Assert.AreEqual(hash, copy);
Assert.AreEqual(hash.ToString(), copy.ToString());
VB.NETCopy Code
Dim hash As Hash = Hash.MD5(TestData)
Dim copy As Hash = Hash.FromBytes(hash.ToArray())
Assert.AreEqual(hash, copy)
Assert.AreEqual(hash.ToString(), copy.ToString())

copy = Hash.FromString(hash.ToString())
Assert.AreEqual(hash, copy)
Assert.AreEqual(hash.ToString(), copy.ToString())

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys