From 55456294e8e3a93320eff6d827d39ee0cad48cc2 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Fri, 17 Apr 2020 17:21:33 +0200 Subject: [PATCH] add debugging to decryption. --- lib/src/internal/crypto_utils.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; }