Commit 3a965a13 by James Tanner

Remove intermediate string on decrypt

parent 9ba053c8
...@@ -432,18 +432,13 @@ class AES(object): ...@@ -432,18 +432,13 @@ class AES(object):
next_chunk = '' next_chunk = ''
finished = False finished = False
out_data = ''
while not finished: while not finished:
chunk, next_chunk = next_chunk, cipher.decrypt(in_file.read(1024 * bs)) chunk, next_chunk = next_chunk, cipher.decrypt(in_file.read(1024 * bs))
if len(next_chunk) == 0: if len(next_chunk) == 0:
padding_length = ord(chunk[-1]) padding_length = ord(chunk[-1])
chunk = chunk[:-padding_length] chunk = chunk[:-padding_length]
finished = True finished = True
out_data += chunk out_file.write(chunk)
# write decrypted data to out stream
out_file.write(out_data)
# reset the stream pointer to the beginning # reset the stream pointer to the beginning
if hasattr(out_file, 'seek'): if hasattr(out_file, 'seek'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment