make static method

String make(
  1. String password, {
  2. int? rounds,
})

has the password using BCrypt technique. A password over maxBytes (72) bytes throws an ArgumentError. The error text does not hold the password, so it is safe to log. Limit the length in your DTO, like max(72).

Hash.make('secret');
Hash.make('secret', rounds: 12);

Implementation

static String make(String password, {int? rounds}) {
  _checkLength(password);
  int cost = rounds ?? Hash.rounds;
  return BCrypt.hashpw(password, BCrypt.gensalt(logRounds: cost));
}