public void HashPassword_WithDefaultSettings_ExpectVerifiableHash()
        {
            var password = Guid.NewGuid().ToString();

            var hasher         = new Argon2PasswordHasher <string>();
            var hashedPassword = hasher.HashPassword("", password);

            PasswordHash.ArgonHashStringVerify(hashedPassword, password).Should().BeTrue();
        }
        public void HashPassword_WithCustomStrength_ExpectVerifiableHash()
        {
            var password = Guid.NewGuid().ToString();

            var hasher = new Argon2PasswordHasher <string>(
                new OptionsWrapper <Argon2PasswordHasherOptions>(
                    new Argon2PasswordHasherOptions {
                Strength = Argon2HashStrength.Sensitive
            }));
            var hashedPassword = hasher.HashPassword("", password);

            PasswordHash.ArgonHashStringVerify(hashedPassword, password).Should().BeTrue();
        }
Exemple #3
0
        public void HashPassword_WithDefaultSettings_ExpectVerifiableHash()
        {
            var password = "******";

            var hasher         = new Argon2PasswordHasher <string>();
            var hashedPassword = hasher.HashPassword("", password);

            output.WriteLine(hashedPassword);

            //this will produce a 32 byte hash
            var hash = PasswordHash.ScryptHashString(password);

            PasswordHash.ArgonHashStringVerify(hashedPassword, password).Should().BeTrue();
        }