diff --git a/lib/utils/crypto_util.dart b/lib/utils/crypto_util.dart index 36a5d7161..192b4f6e1 100644 --- a/lib/utils/crypto_util.dart +++ b/lib/utils/crypto_util.dart @@ -290,13 +290,17 @@ class CryptoUtil { int memLimit = Sodium.cryptoPwhashMemlimitSensitive; int opsLimit = Sodium.cryptoPwhashOpslimitSensitive; Uint8List key; - while (memLimit > Sodium.cryptoPwhashMemlimitMin && - opsLimit < Sodium.cryptoPwhashOpslimitMax) { + while (memLimit >= Sodium.cryptoPwhashMemlimitMin && + opsLimit <= Sodium.cryptoPwhashOpslimitMax) { try { key = await deriveKey(password, salt, memLimit, opsLimit); return DerivedKeyResult(key, memLimit, opsLimit); } catch (e, s) { - logger.severe(e, s); + logger.severe( + "failed to derive memLimit: $memLimit and opsLimit: $opsLimit", + e, + s, + ); } memLimit = (memLimit / 2).round(); opsLimit = opsLimit * 2;