passwd 1.1.0 passwd: ^1.1.0 copied to clipboard
A package for generating strong passwords and measuring password strength.
import 'package:passwd/passwd.dart';
void main() {
print(generatePassword()); // wAOrDoQM
print(
generatePassword(
length: 20,
upperCase: true,
),
); // EKBRFDILDXRDLLKHKTMG
print(
generatePassword(
length: 20,
upperCase: true,
lowerCase: true,
),
); // tsQWcXgeFtlajRYRYrUD
print(
generatePassword(
length: 20,
upperCase: true,
lowerCase: true,
digits: true,
),
); // eCrl6rQqcewzy2kbw7fZ
print(
generatePassword(
length: 40,
upperCase: true,
lowerCase: true,
digits: true,
punctuation: true,
),
); //>1.)}|4wyW35xJxYRd"H
// Measure the strength of the password
print(estimateStrength('123456')); // PasswordStrength.weak
print(estimateStrength('slcjreiuvmk')); // PasswordStrength.weak
print(estimateStrength('KEURIBVJKIUYER')); // PasswordStrength.weak
print(estimateStrength('setgf784156')); // PasswordStrength.good
print(estimateStrength('euhnvHHJGkjhjk')); // PasswordStrength.good
print(estimateStrength('fYjV')); // PasswordStrength.weak
print(estimateStrength('fhjTYRxs48hgRT')); // PasswordStrength.good
print(estimateStrength('pN47bT')); // PasswordStrength.weak
print(estimateStrength('hjfR^f87984L;&gh')); // PasswordStrength.strong
// Measure the strength of generated passwords
print(estimateStrength(generatePassword()));
// PasswordStrength.good
print(estimateStrength(generatePassword(upperCase: true)));
// PasswordStrength.weak
print(estimateStrength(generatePassword(punctuation: true)));
// PasswordStrength.strong
print(estimateStrength(generatePassword(punctuation: true, digits: true)));
// PasswordStrength.strong
print(
estimateStrength(
generatePassword(
length: 15,
punctuation: true,
digits: true,
),
),
); // PasswordStrength.strong
}