示例#1
0
        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);
        }
示例#2
0
        public static bool ComparePassword(this IPasswordHolder holder, string text)
        {
            string textHash = GetPasswordHash(holder.PasswordSalt, text);

            return(textHash == holder.PasswordHash);
        }