using System.Security.Cryptography; namespace Backend.Utils; public class Crypto { public String ComputeHash(Byte[] bytesToHash, Byte[] salt) { var byteResult = new Rfc2898DeriveBytes(bytesToHash, salt, 10000); return Convert.ToBase64String(byteResult.GetBytes(24)); } public string GenerateSalt() { var bytes = new byte[128 / 8]; var rng = new RNGCryptoServiceProvider(); rng.GetBytes(bytes); return Convert.ToBase64String(bytes); } }