34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
namespace Microsoft.AspNet.Identity
|
|
{
|
|
/// <summary>
|
|
/// Implements password hashing methods
|
|
/// </summary>
|
|
public class PasswordHasher : IPasswordHasher
|
|
{
|
|
/// <summary>
|
|
/// Hash a password
|
|
/// </summary>
|
|
/// <param name="password"></param>
|
|
/// <returns></returns>
|
|
public virtual string HashPassword(string password)
|
|
{
|
|
return Crypto.HashPassword(password);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verify that a password matches the hashedPassword
|
|
/// </summary>
|
|
/// <param name="hashedPassword"></param>
|
|
/// <param name="providedPassword"></param>
|
|
/// <returns></returns>
|
|
public virtual PasswordVerificationResult VerifyHashedPassword(string hashedPassword, string providedPassword)
|
|
{
|
|
return Crypto.VerifyHashedPassword(hashedPassword, providedPassword)
|
|
? PasswordVerificationResult.Success
|
|
: PasswordVerificationResult.Failed;
|
|
}
|
|
}
|
|
} |