calculateSaltedPassword method

Future<List<int>> calculateSaltedPassword(
  1. String salt,
  2. int iterations
)

Implementation

Future<List<int>> calculateSaltedPassword(String salt, int iterations) async {
  final pbkdf2 = Pbkdf2(
    macAlgorithm: Hmac(_hash),
    iterations: iterations,
    bits: pbkdfBitsFromHash(hashType),
  );

  final saltedPasswordRaw = await pbkdf2.deriveKey(
    secretKey: SecretKey(
      utf8.encode(
        Saslprep.saslprep(attributes.getConnectionSettings().password),
      ),
    ),
    nonce: base64.decode(salt),
  );
  return saltedPasswordRaw.extractBytes();
}