deriveKey static method

Uint8List deriveKey(
  1. String secret,
  2. List<int> salt, {
  3. int iterations = defaultIterations,
  4. int keylen = defaultKeyLength,
  5. dynamic hmacLength = 64,
})

Creates an derived key from a secret, salt, iterations, keylen and hmacLength.

Implementation

static Uint8List deriveKey(String secret, List<int> salt,
    {int iterations = defaultIterations,
    int keylen = defaultKeyLength,
    hmacLength = 64}) {
  var derivator = PBKDF2KeyDerivator(HMac(SHA256Digest(), hmacLength))
    ..init(Pbkdf2Parameters(Uint8List.fromList(salt), iterations, keylen));
  return derivator.process(Uint8List.fromList(secret.codeUnits));
}