diff --git a/lib/src/internal/crypto_utils.dart b/lib/src/internal/crypto_utils.dart index d4d1f1c..c7254ec 100644 --- a/lib/src/internal/crypto_utils.dart +++ b/lib/src/internal/crypto_utils.dart @@ -1,7 +1,10 @@ import 'dart:typed_data'; +import 'package:logging/logging.dart'; import 'package:pointycastle/export.dart'; +final _logger = Logger('crypto_utils'); + /// https://gist.github.com/proteye/e54eef1713e1fe9123d1eb04c0a5cf9b class AesHelper { static const CBC_MODE = 'CBC'; @@ -84,10 +87,16 @@ class AesHelper { static Uint8List processBlocks(BlockCipher cipher, Uint8List inp) { final out = Uint8List(inp.lengthInBytes); + _logger.finest('Starting processBlocks. (${inp.lengthInBytes})'); + var twoPercent = inp.lengthInBytes ~/ 100 * 2; for (var offset = 0; offset < inp.lengthInBytes;) { - final len = cipher.processBlock(inp, offset, out, offset); - offset += len; + offset += cipher.processBlock(inp, offset, out, offset); + if (offset > twoPercent) { + _logger.finest('> 2% done. ($offset)'); + twoPercent = inp.lengthInBytes; + } } + _logger.finest('Done processBlocks.'); return out; }