App.Security.PasswordHash.Create C# (CSharp) Method

Create() public static method

Creates a salted PBKDF2 hash of the password.
public static Create ( string password ) : PasswordHash
password string The password to hash.
return PasswordHash
        public static PasswordHash Create(string password)
        {
            // Generate a random salt
            var csprng = new RNGCryptoServiceProvider();
            var salt = new byte[SaltBytes];
            csprng.GetBytes(salt);

            // Hash the password and encode the parameters
            var hash = PBKDF2(password, salt, HashIterations, HashBytes);
            return new PasswordHash(hash, salt);
        }