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

Glossary Item Box

Creates the hash algorithm associated with this length of hash

Syntax

Visual Basic (Declaration) 
Public Function CreateAlgorithm() As HashAlgorithm
C# 
public HashAlgorithm CreateAlgorithm()

Example

Library/Library.Test/TestHash.cs

C#Copy Code
foreach(int sz in new int [] { 16, 20, 32, 48, 64 })
{
    Hash test = Hash.FromBytes(new byte[sz]);
    HashAlgorithm ha = test.CreateAlgorithm();
    Assert.IsNotNull(ha);
    Assert.AreEqual(sz, ha.ComputeHash(new byte[0]).Length);
}
VB.NETCopy Code
For Each sz As Integer In New Integer() {16, 20, 32, 48, 64}
    Dim test As Hash = Hash.FromBytes(New Byte(sz) {})
    Dim ha As HashAlgorithm = test.CreateAlgorithm()
    Assert.IsNotNull(ha)
    Assert.AreEqual(sz, ha.ComputeHash(New Byte(0) {}).Length)
Next

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys