Visual Basic (Declaration) | |
---|---|
Public Overloads Function CreateHash() As PasswordHash |
C# | |
---|---|
public PasswordHash CreateHash() |
Library/Library.Test/TestPassword.cs
C# | Copy Code |
---|---|
byte[] pwdBytes = Guid.NewGuid().ToByteArray(); using (Password pwd = new Password(false, pwdBytes)) { using (PasswordHash hash = pwd.CreateHash()) Assert.IsTrue(hash.VerifyPassword(pwdBytes)); using (PasswordHash hash = new PasswordHash(pwd)) Assert.IsTrue(hash.VerifyPassword(pwdBytes)); } using (Password pwd = new Password(false, pwdBytes)) { using (PasswordHash hash = new PasswordHash(false, pwdBytes, new Salt())) Assert.AreEqual(hash, pwd.CreateHash(hash.Salt)); } |
VB.NET | Copy Code |
---|---|
Dim pwdBytes As Byte() = Guid.NewGuid().ToByteArray() Using pwd As New Password(False, pwdBytes) Using hash As PasswordHash = pwd.CreateHash() Assert.IsTrue(hash.VerifyPassword(pwdBytes)) End Using Using hash As New PasswordHash(pwd) Assert.IsTrue(hash.VerifyPassword(pwdBytes)) End Using End Using Using pwd As New Password(False, pwdBytes) Using hash As New PasswordHash(False, pwdBytes, New Salt()) Assert.AreEqual(hash, pwd.CreateHash(hash.Salt)) End Using End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
Password ClassPassword Members
Overload List
PasswordHash