pub package

This package aims to calculate entrophy for plain text passwords, different implementations may have slighty different results from this package.

To use this package, add password_entropy as a dependency in your pubspec.yaml file.

List of characteres that are considered valid in this package:


You don't need to provide this list, and to check if a password is valid the function validatePassword can be used as demonstrated in the example bellow.


import 'package:password_entropy/password_entropy.dart';

void main() {
  //Use via extension method
  final double? entrophy1 = 'mYpassWord'.passwordEntrophy;
  print(entrophy1); // 57.00439718141092

  //Will return null for some special characters like '¬' (invalid password)
  final double? invalidPass = '(¬_¬)'.passwordEntrophy;
  print(invalidPass); // null

  //Use via static method
  final double? entrophy2 = PasswordEntrophy.entrophy('Password');
  print(entrophy2); // 45.60351774512874

  // Checking if password is valid

  print('(¬_¬)'.validatePassword()); // false
  print('(_pasword_)'.validatePassword()); // true
  print('(_pasword_)'.validatePassword(minLenght: 20)); // false

  //Also can be used as static method
      maxLenght: 20,
      minLenght: 3,
  ); // true