Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Avoid redundant copy

Neerajeea70db1fdcd
diff --git a/mobile/plugins/ente_crypto/lib/src/crypto.dart b/mobile/plugins/ente_crypto/lib/src/crypto.dart
index 9f7a10f8c2..52202c5ac9 100644
--- a/mobile/plugins/ente_crypto/lib/src/crypto.dart
+++ b/mobile/plugins/ente_crypto/lib/src/crypto.dart
@@ -57,7 +57,11 @@ Future<Uint8List> cryptoGenericHash(Map<String, dynamic> args) async {
final state =
Sodium.cryptoGenerichashInit(null, Sodium.cryptoGenerichashBytesMax);
await for (final chunk in file.openRead()) {
- Sodium.cryptoGenerichashUpdate(state, Uint8List.fromList(chunk));
+ if (chunk is Uint8List) {
+ Sodium.cryptoGenerichashUpdate(state, chunk);
+ } else {
+ Sodium.cryptoGenerichashUpdate(state, Uint8List.fromList(chunk));
+ }
}
return Sodium.cryptoGenerichashFinal(state, Sodium.cryptoGenerichashBytesMax);
}