hashPasswordStringSync method

DArgon2Result hashPasswordStringSync(
  1. String password, {
  2. required Salt salt,
  3. int iterations = 32,
  4. int memory = 256,
  5. int parallelism = 2,
  6. int length = 32,
  7. Argon2Type type = Argon2Type.i,
  8. Argon2Version version = Argon2Version.V13,
})

The method to hash a password of type String with Argon2.

Needs a UTF-8 String password and a salt to be given with an optional parameters to control the amount of iterations, memory, parallelism used during the operation. Also optionally takes a length parameter for the hash's return length, as well as a type and version to pass along to the C method. This method converts the string to a byte array and calls the hashPasswordBytes with the given byte array.

Returns a DArgon2Result with the hashed password, encoded hash, and various conversion options for the hash and encoded bytes.

Implementation

DArgon2Result hashPasswordStringSync(String password,
    {required Salt salt,
    int iterations = 32,
    int memory = 256,
    int parallelism = 2,
    int length = 32,
    Argon2Type type = Argon2Type.i,
    Argon2Version version = Argon2Version.V13}) {
  return hashPasswordBytesSync(utf8.encode(password),
      salt: salt,
      iterations: iterations,
      memory: memory,
      parallelism: parallelism,
      length: length,
      type: type,
      version: version);
}