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

password

Glossary Item Box

Returns true if the provided password matches this hash

Syntax

Visual Basic (Declaration) 
Public Overloads Function VerifyPassword( _
   ByVal password As Stream _
) As Boolean
C# 
public bool VerifyPassword( 
   Stream password
)

Parameters

password

Example

Library/Library.Test/TestPasswordHash.cs

C#Copy Code
using (PasswordHash pwd1 = new PasswordHash(TEST_PASSWORD))
{
    Assert.IsFalse(pwd1.VerifyPassword(TEST_PASSWORD + " "));
    Assert.IsFalse(pwd1.VerifyPassword(TEST_PASSWORD.Substring(0, TEST_PASSWORD.Length-1)));
    Assert.IsFalse(pwd1.VerifyPassword(""));

    Assert.IsTrue(pwd1.VerifyPassword(TEST_PASSWORD));
    Assert.IsTrue(pwd1.VerifyPassword(Password.Encoding.GetBytes(TEST_PASSWORD)));
    Assert.IsTrue(pwd1.VerifyPassword(new MemoryStream(Password.Encoding.GetBytes(TEST_PASSWORD))));
    Assert.IsTrue(pwd1.VerifyPassword(new Password(TEST_PASSWORD)));
}
VB.NETCopy Code
Using pwd1 As New PasswordHash(TEST_PASSWORD)
    Assert.IsFalse(pwd1.VerifyPassword(TEST_PASSWORD + " "))
    Assert.IsFalse(pwd1.VerifyPassword(TEST_PASSWORD.Substring(0, TEST_PASSWORD.Length - 1)))
    Assert.IsFalse(pwd1.VerifyPassword(""))

    Assert.IsTrue(pwd1.VerifyPassword(TEST_PASSWORD))
    Assert.IsTrue(pwd1.VerifyPassword(Password.Encoding.GetBytes(TEST_PASSWORD)))
    Assert.IsTrue(pwd1.VerifyPassword(New MemoryStream(Password.Encoding.GetBytes(TEST_PASSWORD))))
    Assert.IsTrue(pwd1.VerifyPassword(New Password(TEST_PASSWORD)))
End Using

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys