estimatedGuesses property
Should return the estimated number of guesses for the token.
Implementation
@override
double get estimatedGuesses {
const Map<String, double> charClassBases = <String, double>{
'alphaLower': 26,
'alphaUpper': 26,
'alpha': 52,
'alphanumeric': 62,
'digits': 10,
'symbols': 33,
};
if (charClassBases.containsKey(regExName)) {
return pow(charClassBases[regExName]!, length).toDouble();
}
// TODO: Add more regex types for example special dates like 09.11
switch (regExName) {
case 'recentYear':
// Conservative estimate of year space: num years from currentYear.
// If year is close to currentYear, estimate a year space of
// minYearSpace.
return max(
(int.parse(token) - options.currentYear).abs(),
options.minYearSpace,
).toDouble();
}
return 0;
}