biometry_hash_9.py 425 B

12345678910111213141516171819
  1. def decrypt(key, filename):
  2. chunksize = 64*1024
  3. outputFile = filename[11:]
  4. with open(filename, 'rb') as infile:
  5. filesize = long(infile.read(16))
  6. IV = infile.read(16)
  7. decryptor = AES.new(key, AES.MODE_CBC, IV)
  8. with open(outputFile, 'wb') as outfile:
  9. while True:
  10. chunk = infile.read(chunksize)
  11. if len(chunk) == 0:
  12. break
  13. outfile.write(decryptor.decrypt(chunk))
  14. outfile.truncate(filesize)