public void BruteForceCardinalityTest() { Assert.AreEqual(26, PasswordScoring.PasswordCardinality("asdf")); Assert.AreEqual(26, PasswordScoring.PasswordCardinality("ASDF")); Assert.AreEqual(52, PasswordScoring.PasswordCardinality("aSDf")); Assert.AreEqual(10, PasswordScoring.PasswordCardinality("124890")); Assert.AreEqual(62, PasswordScoring.PasswordCardinality("aS159Df")); Assert.AreEqual(33, PasswordScoring.PasswordCardinality("!@<%:{$:#<@}{+&)(*%")); Assert.AreEqual(100, PasswordScoring.PasswordCardinality("©")); Assert.AreEqual(95, PasswordScoring.PasswordCardinality("ThisIs@T3stP4ssw0rd!")); }
public void PasswordScoringPasswordCardinalityScoresCorrectly(string password, int score) { PasswordScoring.PasswordCardinality(password).Should().Be(score); }
private double CalculateEntropy(string match) { return(Math.Log(PasswordScoring.PasswordCardinality(match) * match.Length, 2)); }