Beispiel #1
0
        /// <summary>
        /// Creates a hash from the specified password string.
        /// </summary>
        /// <param name="password">Password to hash.</param>
        public virtual PasswordCryptographyResult CreateHash(string password)
        {
            var result = new PasswordCryptographyResult();

            result.Hash        = Defuse.PasswordCryptographyV2.CreateHash(password);
            result.HashVersion = (int)PasswordHashVersion.V2;

            return(result);
        }
        public virtual PasswordCryptographyResult CreateHash(string password)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }
            if (string.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentEmptyException(nameof(password));
            }

            var result = new PasswordCryptographyResult();

            result.Hash        = _passwordHasher.HashPassword(new PasswordHasherUser(), password);
            result.HashVersion = (int)PasswordHashVersion.V3;

            return(result);
        }