stretch method

Key stretch(
  1. int desiredKeyLength, {
  2. int iterationCount = 100,
  3. Uint8List? salt,
})

Implementation

Key stretch(int desiredKeyLength,
    {int iterationCount = 100, Uint8List? salt}) {
  if (salt == null) {
    salt = SecureRandom(desiredKeyLength).bytes;
  }

  final params = Pbkdf2Parameters(salt, iterationCount, desiredKeyLength);
  final pbkdf2 = PBKDF2KeyDerivator(Mac('SHA-1/HMAC'))..init(params);

  return Key(pbkdf2.process(_bytes));
}