keyFromPassphrase static method
Implementation
static Future<Uint8List> keyFromPassphrase(
String passphrase, PassphraseInfo info) async {
if (info.algorithm != AlgorithmTypes.pbkdf2) {
throw InvalidPassphraseException('Unknown algorithm');
}
if (info.iterations == null) {
throw InvalidPassphraseException('Passphrase info without iterations');
}
if (info.salt == null) {
throw InvalidPassphraseException('Passphrase info without salt');
}
return await uc.pbkdf2(
Uint8List.fromList(utf8.encode(passphrase)),
Uint8List.fromList(utf8.encode(info.salt!)),
uc.sha512,
info.iterations!,
info.bits ?? 256);
}