deriveKey method
Future<SecretKey>
deriveKey({
- required SecretKey secretKey,
- required List<
int> nonce, - List<
int> optionalSecret = const <int>[], - List<
int> associatedData = const <int>[],
override
Calculates output of Argon2id algorithm.
Parameter secretKey
is the hashed password, which can have any length.
Parameter nonce
is the password salt, which can have any length.
Parameters k
and ad
are optional additional parameters specified by
Argon2. They are usually left empty.
Implementation
@override
Future<SecretKey> deriveKey({
required SecretKey secretKey,
required List<int> nonce,
List<int> optionalSecret = const <int>[],
List<int> associatedData = const <int>[],
}) async {
final state = newState();
try {
final bytes = await state.deriveKeyBytes(
password: await secretKey.extractBytes(),
nonce: nonce,
optionalSecret: optionalSecret,
associatedData: associatedData,
);
return SecretKey(bytes);
} finally {
state.tryReleaseMemory();
}
}