using Microsoft.AspNetCore.Cryptography.KeyDerivation; namespace HyperBooru.Services; public interface IUserService { public bool ShowNsfw { get; set; } public event EventHandler ShowNsfwChanged; } public class UserService : IUserService { public bool ShowNsfw { get => showNsfw; set { showNsfw = value; ShowNsfwChanged?.Invoke(this, value); } } public event EventHandler ShowNsfwChanged; private bool showNsfw = false; public static string HashPassword(string password) => Convert.ToBase64String( KeyDerivation.Pbkdf2( password, Array.Empty(), KeyDerivationPrf.HMACSHA512, 100_000, 512 / 8)); }