public static void SetPassword(this IPasswordHolder holder, string text) { var salt = new byte[32]; RNG.GetBytes(salt); holder.PasswordSalt = salt; holder.PasswordHash = GetPasswordHash(salt, text); }
public static bool ComparePassword(this IPasswordHolder holder, string text) { string textHash = GetPasswordHash(holder.PasswordSalt, text); return(textHash == holder.PasswordHash); }