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