DerivationArtefacts.generate constructor Null safety

DerivationArtefacts.generate(
  1. {dynamic minIterations = 20000,
  2. dynamic defaultLength = 32,
  3. dynamic iterationVariance = 10,
  4. dynamic strategy = DerivationStrategy.pbkdf2Hmac}
)

Randomly generate new key derivation artefacts

Implementation

DerivationArtefacts.generate(
    {minIterations = 20000,
    defaultLength = 32,
    iterationVariance = 10,
    strategy = DerivationStrategy.pbkdf2Hmac})
    : iterations = minIterations +
          _random
              .nextInt((minIterations * (iterationVariance / 100)).floor()),
      strategy = strategy,
      length = defaultLength,
      salt = List<int>.generate(_saltLength, (i) => _random.nextInt(256)),
      version = 'K';