@Override public List<Match> execute(String password) { String reversedPassword = new StringBuilder(password).reverse().toString(); List<Match> matches = new ArrayList<>(); for (Match match: new DictionaryMatcher(this.rankedDictionaries).execute(reversedPassword)) { matches.add(MatchFactory.createReversedDictionaryMatch( password.length() - 1 - match.j, password.length() - 1 - match.i, new StringBuilder(match.token).reverse().toString(), match.matchedWord, match.rank, match.dictionaryName)); } return this.sorted(matches); } }
@Override public List<Match> execute(String password) { String reversedPassword = new StringBuilder(password).reverse().toString(); List<Match> matches = new ArrayList<>(); for (Match match: new DictionaryMatcher(this.rankedDictionaries).execute(reversedPassword)) { matches.add(MatchFactory.createReversedDictionaryMatch( password.length() - 1 - match.j, password.length() - 1 - match.i, new StringBuilder(match.token).reverse().toString(), match.matchedWord, match.rank, match.dictionaryName)); } return this.sorted(matches); } }
if (sub.isEmpty()) break; String subbedPassword = translate(password, sub); for (Match match: new DictionaryMatcher(rankedDictionaries).execute(subbedPassword)) { String token = password.substring(match.i, match.j + 1); if (token.toLowerCase().equals(match.matchedWord)) continue;
if (sub.isEmpty()) break; String subbedPassword = translate(password, sub); for (Match match: new DictionaryMatcher(rankedDictionaries).execute(subbedPassword)) { String token = password.substring(match.i, match.j + 1); if (token.toLowerCase().equals(match.matchedWord)) continue;
@Test public void testDictionaryMatching() throws Exception { List<Match> actualMatches = new DictionaryMatcher(dictionaries).execute(password); assertMatches(message, Pattern.Dictionary, expectedMatches, actualMatches); }