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: KEY_ITERATIONS_COUNT,
    bits: KEY_LENGTH * 8,
  );

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

  return await secret;
}