Encryption with Python

Peter Hansen peter at engcorp.com
Wed Jun 23 00:50:39 EDT 2004


Kamilche wrote:

> I've looked at a few alternatives for encryption with Python, and
> didn't come up anything very speedy.
> 
> I've written an encryption algorithm in pure Python that can process
> 22 megs of data a second. I know it's not secure, but it should be
> enough to ward off casual hacking. Does someone know of something
> speedier?

In addition to Erik and Paul's comments: if you don't specify
what machine you ran your benchmark on, the number "22MB/s" is
completely meaningless...

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...

Doing anything meaningful with real data, no matter how trivial
the algorithm, would definitely take longer.

-Peter



More information about the Python-list mailing list