Reduce the memlimit for pwhash
This commit is contained in:
parent
bb85b8f774
commit
a4323ad280
2 changed files with 4 additions and 3 deletions
|
@ -55,7 +55,7 @@ class Configuration {
|
|||
final encryptedKeyData = await CryptoUtil.encrypt(key, key: kek);
|
||||
|
||||
// Hash the passphrase so that its correctness can be compared later
|
||||
final passphraseHash = await CryptoUtil.hash(utf8.encode(passphrase));
|
||||
final passphraseHash = CryptoUtil.hash(utf8.encode(passphrase));
|
||||
final attributes = KeyAttributes(
|
||||
passphraseHash: passphraseHash,
|
||||
kekSalt: Sodium.bin2base64(kekSalt),
|
||||
|
|
|
@ -169,11 +169,12 @@ class CryptoUtil {
|
|||
Sodium.cryptoPwhashAlgDefault);
|
||||
}
|
||||
|
||||
static Future<String> hash(Uint8List passphrase) async {
|
||||
static String hash(Uint8List passphrase) {
|
||||
Sodium.init();
|
||||
return Sodium.cryptoPwhashStr(
|
||||
passphrase,
|
||||
Sodium.cryptoPwhashOpslimitSensitive,
|
||||
Sodium.cryptoPwhashMemlimitSensitive);
|
||||
Sodium.cryptoPwhashMemlimitModerate);
|
||||
}
|
||||
|
||||
static bool verifyHash(Uint8List passphrase, String hash) {
|
||||
|
|
Loading…
Add table
Reference in a new issue