Re: Fast Encryption
"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:eODsb1MiJHA.956@TK2MSFTNGP05.phx.gbl...
Unfortunately, I'm not all that knowledgeable on encryption. The one I'm
playing with was found at:
http://www.codeproject.com/KB/security/crypt_routine.aspx
I've been able to optimize it a but would like it faster on large files.
I'm thinking the crypto stuff would actually be slower.
I'm certainly open to any suggestions though.
I'm looking at making a program so it stores its data encrypted. In most
cases, it would only need casual encryption. However, the program could
easily be used to store passwords, etc.
When I started using encryption for my shareware protection, I was struck by
how many partially documented solutions there are. It's hard to know which
is best for your application, especially when your needs are changing, e.g.
will I store passwords or won't I? The article you referenced is based on
RC4, a popular though aging stream cipher. Ironically, wikipedia said it's
known for its speed, so how fast does your stuff need to be? ;)
If only casual encryption is required, you won't find much faster than a
simple XOR algorithm. Simply XOR each byte of your content with a fixed or
varying byte and save the result. When you read it back, XOR each byte with
the same value you used the first time on that byte. This works because
XORing a byte with the same value twice leads to the original value. XOR is
something that computers natively know how to do; the transistor gates in
the hardware are built up from XOR basic building blocks. Perhaps you could
start with XOR and delay further study until it is readily apparent that you
need better encryption.
-- David