Last updated:
0 purchases
passwd
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
copied to clipboard
Then run:
dart pub get
copied to clipboard
or
flutter pub get
copied to clipboard
Getting started #
First import
import 'package:passwd/passwd.dart';
copied to clipboard
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
copied to clipboard
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
copied to clipboard
by Shervin Hassanzadeh #
Contact me at
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.