/// <inheritdoc/> public bool TestAndScore(string password) { // Reset FailureMessage = null; ScoreModifier = 0; // Check for inactive if (Settings.MaxNeighboringCharacter < 1) { return(true); } // Do work var patterns = PatternMapService.GetPatterns(password, PatternMap); // Adjust score ScoreModifier = patterns.Sum(x => - (int)Math.Pow(2, x.Length)); // Return result var pass = patterns.Any(x => x.Length > Settings.MaxNeighboringCharacter) == false; if (pass == false) { FailureMessage = string.Format(Resources.FailedPattern, Settings.MaxNeighboringCharacter); } return(pass); }
public bool TestAndScore(string password) { // Reset FailureMessage = null; ScoreModifier = 0; // Check for inactive if (Settings.MaxNeighboringCharacter < 1) { return(true); } // Do work var patterns = PatternMapService.GetPatterns(password, PatternMap); // Adjust score ScoreModifier = patterns.Sum(x => - (int)Math.Pow(2, x.Length)); // Return result var pass = patterns.Any(x => x.Length > Settings.MaxNeighboringCharacter) == false; if (pass == false) { FailureMessage = $"Can have a maximum of {Settings.MaxNeighboringCharacter} characters that neighbor each other on the keyboard"; } return(pass); }