xcvbnm 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

xcvbnm #

This is a dart port of the great dropbox/zxcvbn library, a realistic password strength estimator.

This library is strong mode compliant.

Please note, that library did not port all functionality but is already used in production.

Usage #

library xcvbnm.example.bin;

import 'package:xcvbnm/xcvbnm.dart';

main() {
  String password = "my_pwd_1";
  // Use the direct helper API
  Result result = new Xcvbnm().estimate(password);

Demo #

Browser #

Online demo dart code compiled with dart2js

Command line #

$  dart bin/xcvbnm_demo.dart --help
  -h, --help     Usage help
  -m, --match    Max number max of match to display
                 (defaults to "4")
$ dart bin/xcvbnm_demo.dart
$ dart bin/xcvbnm_demo.dart 9IOksjdopwd
$ dart bin/xcvbnm_demo.dart "my password"
$ dart bin/xcvbnm_demo.dart pwd1 pwd2 -m 1

Development #

Guidelines and format #

Before each commit format at the root of the project

$ dartfmt -l 120 -w .

Test #

Run all tests in multiple platforms

$ ./test/bin/run_tests.sh

1.0.0 #

  • Slight cleanup and 1.0.0 release

0.5.7 #

  • Remove all implicit cast issues

0.5.6 #

  • Fixed all dart 2.0 errors and warnings

0.5.5 #

  • Started Changelog
  • Made xcvbnm strong-mode compliant


import 'package:xcvbnm/xcvbnm.dart';

final xcvbnm = new Xcvbnm();

void main() {
  final password = 'my_pwd_1';
  final Result result = xcvbnm.estimate(password);

  if (result.score < 3) {
    print('Password not strong enough. It can be cracked in '
        '${result.crackTimeDisplay}. ${result.feedback}');

Use this package as a library

1. Depend on it

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

  xcvbnm: ^1.0.0

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:xcvbnm/xcvbnm.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/matching.dart. (-14.39 points)

Analysis of lib/src/matching.dart reported 31 hints, including:

line 80 col 18: Unnecessary new keyword.

line 81 col 18: Unnecessary new keyword.

line 82 col 12: Unnecessary new keyword.

line 83 col 19: Unnecessary new keyword.

line 84 col 13: Unnecessary new keyword.

Fix lib/src/scoring.dart. (-7.71 points)

Analysis of lib/src/scoring.dart reported 16 hints, including:

line 115 col 7: Use isNotEmpty instead of length

line 413 col 9: Unnecessary new keyword.

line 415 col 16: Unnecessary new keyword.

line 463 col 34: Use isNotEmpty instead of length

line 635 col 25: Unnecessary new keyword.

Fix lib/src/feedback.dart. (-1.99 points)

Analysis of lib/src/feedback.dart reported 4 hints:

line 49 col 9: Use isEmpty instead of length

line 96 col 11: DO use curly braces for all flow control structures.

line 98 col 11: DO use curly braces for all flow control structures.

line 100 col 11: DO use curly braces for all flow control structures.

Fix lib/src/xcvbnm.dart. (-1 points)

Analysis of lib/src/xcvbnm.dart reported 2 hints:

line 17 col 18: Unnecessary new keyword.

line 18 col 20: Unnecessary new keyword.

Maintenance suggestions

Package is getting outdated. (-70.41 points)

The package was last published 88 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <3.0.0
Dev dependencies
args any
browser any
test ^0.12.20