makeAsync static method

Future<String> makeAsync(
  1. String password, {
  2. int? rounds,
})

same as make, but runs bcrypt in a new isolate, so the server can answer other requests in the meantime.

String hash = await Hash.makeAsync('secret');

Implementation

static Future<String> makeAsync(String password, {int? rounds}) {
  int cost = rounds ?? Hash.rounds;
  return Isolate.run(() {
    return BCrypt.hashpw(password, BCrypt.gensalt(logRounds: cost));
  });
}