[pycrypto] Public Key encryption of files

Dave Pawson dave.pawson at gmail.com
Fri Nov 11 08:33:56 CST 2011


On 11 November 2011 13:21, Dean Macinskas <dmacinskas at geobridge.net> wrote:
> Dave,
>
> For what you're doing the example is fine, but I think you'd be disappointed in the performance if your file was 10mb instead of 1 kb.  Why? Because CFB-8 requires an AES cycle *PER BYTE*.  So encrypting 1024 bytes requires 1024 AES cycles, compared to 64 if you used CBC.


Could you tell me how to change the code please, to use the less extravagent ???
whatever CBC is?

Guessing. In
def encrypt(plaintext, secret, lazy=True, checksum=True):
  ....
 encobj = AES.new(secret, AES.MODE_CFB)
 plaintext += struct.pack("i", zlib.crc32(plaintext))

Is it the change to the first line above? If so, how to specify CBC please?


TIA




-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk


More information about the pycrypto mailing list