Encryption with Python
Paul Rubin
http
Wed Jun 23 01:48:46 EDT 2004
Peter Hansen <peter at engcorp.com> writes:
> Besides, what you say is not possible. On my machine,
> which is about a P4 2500MHz, scanning an array.array('c') with
> 22MB of data in it, doing nothing but reading each byte and
> ignoring it, takes about 8 seconds. So does converting the
> array to a list, which is pretty much all C code. Strings
> are immutable, so you can't be working with one of them...
Well, you could do 32-bit operations which are maybe 4x faster.
You could maybe get even more speedup using built-in C functions.
For example, you could do rot13 encryption with the string.translate
method which should be quite fast. FWIW,
http://www.nightsong.com/phr/crypto/p3.py
should be quite secure, and should run at least 1 mbyte/sec on your
p4/2500, maybe quite a bit more.
More information about the Python-list
mailing list