dbcrypt 2.0.0 copy "dbcrypt: ^2.0.0" to clipboard
dbcrypt: ^2.0.0 copied to clipboard

A port of jBCrypt to Dart. It allows to encrypt passwords using BCrypt with a configurable work factor and check passwords.

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);
}
45
likes
140
pub points
95%
popularity

Publisher

verified publishererlantz.net

A port of jBCrypt to Dart. It allows to encrypt passwords using BCrypt with a configurable work factor and check passwords.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

More

Packages that depend on dbcrypt