passwd 1.1.0 passwd: ^1.1.0 copied to clipboard
A package for generating strong passwords and measuring password strength.
Password Generator #
By using passwd
package,
- you can generate a strong password that includes a wide set of characters, such as upper and lowercase characters, numbers, special characters or punctuation.
- Measure the strength of a password
🔑 🗝️ 🔐
Install Package #
add the following line to your pubspec.yaml
under dependencies
:
dependencies:
passwd: ^1.0.0
Then run:
dart pub get
or
flutter pub get
Getting started #
First import
import 'package:passwd/passwd.dart';
Usage #
Now in your dart code, you can use:
print(generatePassword()); // TNCrPnot
print(
generatePassword(
length: 20,
upperCase: true,
),
); // VIMTANUPYBTMPICFESYL
print(
generatePassword(
length: 20,
upperCase: true,
lowerCase: true,
),
); // TdClmuvLBQwcMHkUKxHl
print(
generatePassword(
length: 20,
upperCase: true,
lowerCase: true,
digits: true,
),
); // zp3AzPXvw6h35ZaEgPl1
print(
generatePassword(
length: 40,
upperCase: true,
lowerCase: true,
digits: true,
punctuation: true,
),
); // Y#%_8f^ZJ6>IZGv]SmZBqun3"e6k$5ia>IaeKikx
You can also find out how strong a password is
// 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
by Shervin Hassanzadeh #
Contact me at