generateKey static method

Uint8List generateKey(
  1. String password,
  2. Uint8List salt
)

Generates a 32 byte length key by using the specified password and a password salt.

Implementation

static Uint8List generateKey(String password, Uint8List salt) {
  var passwordBytes = Uint8List.fromList(password.codeUnits);
  var params = Pbkdf2Parameters(
      salt, RNCryptorSettings.pbkdf2Iterations, RNCryptorSettings.keyLength);
  var keyDerivator = PBKDF2KeyDerivator(HMac(SHA1Digest(), 64));
  keyDerivator.init(params);
  return keyDerivator.process(passwordBytes);
}