Argon2HashUtil constructor

Argon2HashUtil({
  1. required String hashPepper,
  2. List<String> fallbackHashPeppers = const [],
  3. required int hashSaltLength,
  4. Argon2HashParameters? parameters,
})

Creates a new instance of Argon2HashUtil.

The class creates hashes in the PHC format: $argon2id$v=19$m={memory},t={iterations},p={lanes}${base64Salt}${base64Hash}

hashPepper is the primary pepper to use for hashing. fallbackHashPeppers is an optional list of peppers to try when validating. hashSaltLength is the length of the salt to generate (in bytes). parameters is the hash parameters used when creating new hashes,

Implementation

Argon2HashUtil({
  required final String hashPepper,
  final List<String> fallbackHashPeppers = const [],
  required final int hashSaltLength,
  final Argon2HashParameters? parameters,
}) : _hashPeppers = [
       utf8.encode(hashPepper),
       ...fallbackHashPeppers.map(utf8.encode),
     ],
     _hashSaltLength = hashSaltLength,
     _parameters = parameters ?? Argon2HashParameters();