17 lines
487 B
C#
17 lines
487 B
C#
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using Application.Services.HashingAlgorithms;
|
|
|
|
namespace Infrastructure.Services.HashingAlgorithms;
|
|
|
|
public class HashingAlgorithms : IHashingAlgorithms
|
|
{
|
|
public string? Sha256Algorithm(string? password)
|
|
{
|
|
if (password == null) return null;
|
|
|
|
using var sha256 = SHA256.Create();
|
|
var bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(password));
|
|
return Convert.ToBase64String(bytes);
|
|
}
|
|
} |