[pycrypto] Public Key encryption of files
dmacinskas at geobridge.net
Thu Nov 10 13:28:54 CST 2011
An AES key can be 16, 24 or 32 bytes, but the data block size for AES is 16 bytes, regardless of key length.
From: pycrypto-bounces at lists.dlitz.net [mailto:pycrypto-bounces at lists.dlitz.net] On Behalf Of Dave Pawson
Sent: Thursday, November 10, 2011 1:27 PM
To: PyCrypto discussion list
Subject: Re: [pycrypto] Public Key encryption of files
On 10 November 2011 18:18, Dean Macinskas <dmacinskas at geobridge.net> wrote:
> All blocks need to be 16 bytes. So for example, if the file is 2,000,005
> bytes, you'd encrypt 125,000 16-byte blocks; you then have 5 bytes left
> over, to which you'd add 11 padding bytes, which can be any binary value and
> then encrypt that last block.
def _lazysecret(secret, blocksize=32, padding='}'):
"""pads secret if not legal AES block size (16, 24, 32)"""
if not len(secret) in (16, 24, 32):
return secret + (blocksize - len(secret)) * padding
Python makes it quite easy.
The reason I started to use it!
great piece of software.
XSLT XSL-FO FAQ.
pycrypto mailing list
pycrypto at lists.dlitz.net
More information about the pycrypto