mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-02-18 23:06:07 -05:00
24 lines
507 B
C#
24 lines
507 B
C#
namespace Cleanuparr.Infrastructure.Features.Auth;
|
|
|
|
public sealed class PasswordService : IPasswordService
|
|
{
|
|
private const int WorkFactor = 12;
|
|
|
|
public string HashPassword(string password)
|
|
{
|
|
return BCrypt.Net.BCrypt.HashPassword(password, WorkFactor);
|
|
}
|
|
|
|
public bool VerifyPassword(string password, string hash)
|
|
{
|
|
try
|
|
{
|
|
return BCrypt.Net.BCrypt.Verify(password, hash);
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|