public void OnlyUpperCase()
        {
            var passwordSettings = new PasswordSettings();

            passwordSettings.Length            = 10;
            passwordSettings.IncludeAlphaUpper = true;
            passwordSettings.ForceEach         = true;

            var pwd = PasswordGenerator.Generate(passwordSettings);

            Assert.AreEqual(10, pwd.Length);

            var entropy = PasswordGenerator.CalcRealEntropy(pwd);

            // L = Number of symbols in the password
            // N = number of possible symbols
            // L  log 2   N
            // 10 Log[2, 26] = 47.004
            Assert.IsTrue(entropy >= 47, "Entropy was {0}, but exptected higher than {1}", entropy, 64);
        }
        public void AllSymbolsMinLength()
        {
            var passwordSettings = new PasswordSettings();

            passwordSettings.Length                   = 5;
            passwordSettings.IncludeNumeric           = true;
            passwordSettings.IncludeAlphaLower        = true;
            passwordSettings.IncludeAlphaUpper        = true;
            passwordSettings.IncludeSymbolSetNormal   = true;
            passwordSettings.IncludeSymbolSetExtended = true;
            passwordSettings.ForceEach                = true;

            var pwd = PasswordGenerator.Generate(passwordSettings);

            Assert.AreEqual(5, pwd.Length);

            var entropy = PasswordGenerator.CalcRealEntropy(pwd);

            // L = Number of symbols in the password
            // N = number of possible symbols
            // L  log 2   N
            // 5 Log[2, 90] = 32.459
            Assert.IsTrue(entropy >= 32, "Entropy was {0}, but exptected higher than {1}", entropy, 32);
        }
Exemple #3
0
        public void SimpleTest()
        {
            var result = PasswordGenerator.CalcRealEntropy("qwert");

            Assert.AreNotEqual(0, result);
        }
Exemple #4
0
        public void AllSymbols()
        {
            var result = PasswordGenerator.CalcRealEntropy("Ggb:3z/:T3");

            Assert.AreEqual(64, result);
        }
Exemple #5
0
        public void LowerAndUpperCase()
        {
            var result = PasswordGenerator.CalcRealEntropy("lxDHNQCAFX");

            Assert.AreEqual(57, result);
        }
Exemple #6
0
        public void OnlyUpperCase()
        {
            var result = PasswordGenerator.CalcRealEntropy("CXVQUUCLNH");

            Assert.AreEqual(47, result);
        }
Exemple #7
0
        public void OnlyLowerCase()
        {
            var result = PasswordGenerator.CalcRealEntropy("cxvquuclnh");

            Assert.AreEqual(47, result);
        }
Exemple #8
0
        public void OnlyNumeric()
        {
            var result = PasswordGenerator.CalcRealEntropy("8242377558");

            Assert.AreEqual(33, result);
        }