generatePasswordHash function Null safety

String generatePasswordHash(
  1. String password,
  2. String salt,
  3. {int hashRounds = 1000,
  4. int hashLength = 32,
  5. Hash? hashFunction}
)

A utility method to generate a password hash using the PBKDF2 scheme.

Implementation

String generatePasswordHash(
  String password,
  String salt, {
  int hashRounds = 1000,
  int hashLength = 32,
  Hash? hashFunction,
}) {
  final generator = PBKDF2(hashAlgorithm: hashFunction ?? sha256);
  return generator.generateBase64Key(password, salt, hashRounds, hashLength);
}