dbcrypt 1.0.0

Dart native js
Flutter Android iOS web

A port of jBCrypt to Dart. It allows to encrypt passwords using BCrypt with a configurable work factor to make it more expensive to create (and secure) as machines get faster. It also allows to check

example/example.dart

import 'package:dbcrypt/dbcrypt.dart';

void main() {
  DBCrypt dBCrypt = DBCrypt();
  const plainPwd = "mySuperSecretP@ssw0rd";
  // Hash password with default values
  String hashedPwd = dBCrypt.hashpw(plainPwd, dBCrypt.gensalt());

  // Check the plain password against the hashed password
  assert(dBCrypt.checkpw(plainPwd, hashedPwd), true);

  // Generate a salt with a cost of 12 and hash the password with it
  String salt = dBCrypt.gensaltWithRounds(12);
  hashedPwd = dBCrypt.hashpw(plainPwd, salt);

  // Check the plain password against the 12-cost hashed password
  assert(dBCrypt.checkpw(plainPwd, hashedPwd), true);
}
5
likes
90
pub points
88%
popularity

A port of jBCrypt to Dart. It allows to encrypt passwords using BCrypt with a configurable work factor to make it more expensive to create (and secure) as machines get faster. It also allows to check passwords that have been encrypted using the original BCrypt algorithm and it's a, y and b revisions.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

erlantz8@gmail.com

License

BSD (LICENSE)

More

Packages that depend on dbcrypt