nullprogram.com/blog/2009/04/24/
If you are a
crypto-anarchist like me, you should definitely take a look
at CipherSaber. It is an
extremely simple encryption protocol that even beginner programmers
can implement. The protocol can also easily be memorized and quickly
implemented from memory on the fly. In the case that cryptography was
completely outlawed, CipherSaber would be a useful tool in allowing
its users to continue to communicate privately.
I think the name is just perfect and captures everything CipherSaber
is about. Here is the description right from the CipherSaber page,
In George Lucas' Star Wars trilogy, Jedi Knights were expected to
make their own light sabers. The message was clear: a warrior
confronted by a powerful empire bent on totalitarian control must
be self-reliant.
CipherSaber is based on the arcfour
stream cipher, but goes beyond it by defining the use of an
initialization vector (IV) and how it is stored with the
ciphertext. There are actually two versions: CipherSaber-1 and
CipherSaber-2. The second one exists because of vulnerabilities in the
first. The difference between them is small.
You want to make sure you generate a long enough passphrase for your
encryption key. A normal password isn't good enough because an
adversary will be able to throw all his available processing power at
your ciphertext. Using Diceware would
be a good idea here.
Here is the protocol.
Generate a 10-byte random IV. This need not be done using a very
strong random number generator. It is only important that the same IV
is not used more than once. Concatenate a secret user selected key
(i.e. passphrase) with the IV and use that concatenation as the key
for an arcfour cipher. Encrypt the message using the
cipher. Concatenate the IV and the arcfour ciphertext to create the
CipherSaber ciphertext.
To decipher, remove the first ten bytes of the ciphertext and use it
as an IV. Concatenate the secret passphrase with the IV, and use it as
the key for an arcfour cipher. Decrypt the remaining ciphertext with
the arcfour cipher.
Because of vulnerabilities in the arcfour cipher, CipherSaber-2 is an
updated version that runs the arcfour key scheduler at least 20
times. The exact number of times is a secret that the sender and
receiver must agree on. Notice that CipherSaber-1 is CipherSaber-2
with only 1 key schedule iteration.
Using a large number of iterations could be considered a form of key
strengthening. An adversary who is making a brute force attack on
the ciphertext has that much more work to do for each passphrase
trial.
You should really implement your own, but here is one of my
implementations, written in C. I put it in with the rest of my arcfour
stuff. Get it with git,
git clone git://github.com/skeeto/arcfour.git
You can use it as a reference to make sure your first implementation
is correct. You can use these two ciphertexts to test your
implementation as well,
ciphersaber.png.cs
ciphersaber.png.cs2
This is the diagram image above (ciphersaber.png) encrypted with the
key "nullprogram". The first one is CipherSaber-1 and the second is
CipherSaber-2 with 20 key schedule iterations.