password_entropy 2.0.1 copy "password_entropy: ^2.0.1" to clipboard
password_entropy: ^2.0.1 copied to clipboard

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

example/password_entropy_example.dart

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
  print(
    PasswordEntrophy.validatePassword(
      '(_pasword_)',
      maxLenght: 20,
      minLenght: 3,
    ),
  ); // true
}
5
likes
160
points
36
downloads

Publisher

verified publisherthiagofontes.dev

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on password_entropy