argon2Derive method
Uint8List
argon2Derive(
- Uint8List password,
- Uint8List salt, {
- Argon2Options options = const Argon2Options(),
- Argon2Backend? backend,
Derives options.length bytes from password and salt.
backend forces an implementation; by default the native one is used
when available. Note that OpenSSL rejects lanes > 1 unless its library
context has a thread pool configured, so with more lanes this falls back
to the Dart implementation instead of failing.
Implementation
Uint8List argon2Derive(
Uint8List password,
Uint8List salt, {
Argon2Options options = const Argon2Options(),
Argon2Backend? backend,
}) {
_validate(options, salt);
final useNative = backend == null
? hasNativeArgon2 && options.lanes == 1
: backend == Argon2Backend.native;
if (useNative) {
return _deriveNative(password, salt, options);
}
return _deriveDart(password, salt, options);
}