diff --git a/lib/src/crypto/protected_salt_generator.dart b/lib/src/crypto/protected_salt_generator.dart index f0219c5..891da36 100644 --- a/lib/src/crypto/protected_salt_generator.dart +++ b/lib/src/crypto/protected_salt_generator.dart @@ -7,13 +7,15 @@ import 'package:pointycastle/export.dart'; class ProtectedSaltGenerator { factory ProtectedSaltGenerator(Uint8List key) { final hash = sha256.convert(key).bytes as Uint8List; - final cipher = Salsa20Engine()..init(false, ParametersWithIV(KeyParameter(hash), SalsaNonce)); + final cipher = Salsa20Engine() + ..init(false, ParametersWithIV(KeyParameter(hash), salsaNonce)); return ProtectedSaltGenerator._(cipher); } ProtectedSaltGenerator._(this._cipher); - static final SalsaNonce = Uint8List.fromList([0xE8, 0x30, 0x09, 0x4B, 0x97, 0x20, 0x5D, 0x2A]); + static final salsaNonce = + Uint8List.fromList([0xE8, 0x30, 0x09, 0x4B, 0x97, 0x20, 0x5D, 0x2A]); final StreamCipher _cipher; String decryptBase64(String protectedValue) { diff --git a/lib/src/crypto/protected_value.dart b/lib/src/crypto/protected_value.dart index 8df4ea7..e4f34bd 100644 --- a/lib/src/crypto/protected_value.dart +++ b/lib/src/crypto/protected_value.dart @@ -73,6 +73,11 @@ class ProtectedValue implements StringValue { bool operator ==(dynamic other) => other is ProtectedValue && other.getText() == getText(); + int _hashCodeCached; + + @override + int get hashCode => _hashCodeCached ??= getText().hashCode; + @override String toString() { return 'ProtectedValue{${base64.encode(hash)}}'; diff --git a/lib/src/kdbx_object.dart b/lib/src/kdbx_object.dart index dc32f65..070d6ef 100644 --- a/lib/src/kdbx_object.dart +++ b/lib/src/kdbx_object.dart @@ -11,6 +11,7 @@ import 'package:uuid/uuid.dart'; import 'package:uuid/uuid_util.dart'; import 'package:xml/xml.dart'; +// ignore: unused_element final _logger = Logger('kdbx.kdbx_object'); class ChangeEvent {