[pycrypto] Public Key encryption of files
dave.pawson at gmail.com
Thu Nov 10 12:26:52 CST 2011
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.
More information about the pycrypto