From 6d0d526a666110e3a0be7481a1295abae62f99ff Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Fri, 12 Jul 2013 13:18:03 +0200 Subject: [PATCH] Fixed AESCrypt.encrypt with no data multiple of bs --- deltatar/aescrypto.py | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/deltatar/aescrypto.py b/deltatar/aescrypto.py index c33f1af..3d8066f 100644 --- a/deltatar/aescrypto.py +++ b/deltatar/aescrypto.py @@ -80,13 +80,17 @@ class AESCrypt: ''' self.buf += chunk - - chunk = self.buf - if len(chunk) % self.bs == 0: + if len(self.buf) % self.bs == 0: self.buf = '' - return self.cipher.encrypt(chunk) + return self.cipher.encrypt(self.buf) + + cipher = '' + while len(self.buf) >= self.bs: + chunk = self.buf[:self.bs] + self.buf = self.buf[self.bs:] + cipher += self.cipher.encrypt(chunk) - return '' + return cipher def decrypt(self, buf, end=False): ''' -- 1.7.1