[pycrypto] Public Key encryption of files

Dean Macinskas dmacinskas at geobridge.net
Fri Nov 11 07:21:05 CST 2011


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.

The example was just that: an example.  No need to optimize if the purpose is to demonstrate how to use pycrypto.

Dean

-----Original Message-----
From: pycrypto-bounces at lists.dlitz.net [mailto:pycrypto-bounces at lists.dlitz.net] On Behalf Of Dave Pawson
Sent: Friday, November 11, 2011 1:36 AM
To: PyCrypto discussion list
Subject: Re: [pycrypto] Public Key encryption of files

On 10 November 2011 19:48, Dean Macinskas <dmacinskas at geobridge.net> wrote:
> Dave,
>
> I took a closer look - apparently the code accepts a user string for the key, then pads it to the next higher valid length.  So the procedure you referenced is for padding KEYS, not data.  The example also used CFB mode, which is actually a form of stream cipher, and thus encrypts byte-for-byte and requires no data padding.  But it's really inefficient (you only use 1 byte out of 16); for file encryption CBC is still the best option, IMHO.
>
> Dean

Sorry Dean. Straight over my head.
My data is a ....1K file of password info? It encrypts/decrypts in
'human' time with no
proble, i.e. it does the job I want? So (for me) the inefficiency  is
not an issue?
 Agreed using '1 byte out of 16' does sound bad.
If you have the cycles, perhaps you might suggest an improvement to the code?
I'll pass it back to the author?

regards




>
> -----Original Message-----
> From: pycrypto-bounces at lists.dlitz.net [mailto:pycrypto-bounces at lists.dlitz.net] On Behalf Of Dave Pawson
> Sent: Thursday, November 10, 2011 2:34 PM
> To: PyCrypto discussion list
> Subject: Re: [pycrypto] Public Key encryption of files
>
> On 10 November 2011 19:28, Dean Macinskas <dmacinskas at geobridge.net> wrote:
>> Dave,
>>
>> An AES key can be 16, 24 or 32 bytes, but the data block size for AES is 16 bytes, regardless of key length.
>>
>> Dean
>
> Sorry, I used the software as is, found it works (still does) and left
> well alone?
> My crypto knowledge is ... minimal!
>
> At the url I included, perhaps that is set at 16 prior to the call?
>
>
>
> regards
>
>
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>



-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk
_______________________________________________
pycrypto mailing list
pycrypto at lists.dlitz.net
http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto


More information about the pycrypto mailing list