deriveKey static method

Future<SecretKey> deriveKey(
  1. String password,
  2. List<int> salt
)

Password Based Key Deriviation function

Implementation

static Future<SecretKey> deriveKey(String password, List<int> salt) async {
  final pbkdf2 = Pbkdf2(
    macAlgorithm: Hmac.sha512(),
    iterations: _keyIterationsCount,
    bits: _keyLength * 8,
  );

  final SecretKey secret = await pbkdf2.deriveKey(
    secretKey: SecretKey(utf8.encode(password)),
    nonce: salt,
  );

  return secret;
}