password_strength 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 89

Password Strength Estimator #

A basic password strength estimator for Dart. Considers the length of the password, used characters, and whether or not the password appears in the top 10,000 most used passwords.

Usage #

import 'package:password_strength/password_strength.dart';

...

double strength = estimatePasswordStrength('passw0rd');

if (strength < 0.3)
  print('This password is weak!');

0.1.2 #

  • Fix repository link
  • Return 0.0 for empty strings

0.1.1 #

  • Apply health suggestions
  • Fix maintenance issues and apply suggestions

0.1.0 #

  • Initial release

example/main.dart

import 'dart:io';
import 'package:password_strength/password_strength.dart';

void main() {
  // Read a password from stdin.
  print('Please enter a password:');
  final password = stdin.readLineSync();

  // Estimate the password's strength.
  double strength = estimatePasswordStrength(password);

  // Print a response
  if (strength < 0.3) {
    print('This password is weak!');
  } else if (strength < 0.7) {
    print('This password is alright.');
  } else {
    print('This passsword is strong!');
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  password_strength: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:password_strength/password_strength.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Nov 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:password_strength/password_strength.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
test ^1.6.3