20 lines
651 B
Dart
20 lines
651 B
Dart
/// Liste häufiger Passwörter (Implementierung in `data/`).
|
|
abstract interface class CommonPasswordList {
|
|
/// `true`, wenn [password] auf der Liste steht. Vergleich ohne Groß- und
|
|
/// Kleinschreibung, nach Trim.
|
|
bool contains(String password);
|
|
}
|
|
|
|
/// Einfache In-Memory-Liste aus bereits normalisierten Einträgen
|
|
/// (Kleinschreibung, ohne Leerraum am Rand).
|
|
class SetCommonPasswordList implements CommonPasswordList {
|
|
const SetCommonPasswordList(this._entries);
|
|
|
|
final Set<String> _entries;
|
|
|
|
int get length => _entries.length;
|
|
|
|
@override
|
|
bool contains(String password) =>
|
|
_entries.contains(password.trim().toLowerCase());
|
|
}
|