Hello,


I've always wanted to learn about cryptography. Since I think an
implementation of an algorithm is a reasonable start into new fields, I
grabbed the chance opened by Peter Gutmann's RRC2 specification. So this is
my implementation of it, and my first stab at cryptography.


As you can see by looking at the code, I typed the C code directly into the
specification. So there is a single document (rrc2.c), which is both, the
specification and a compilable (ANSI (I hope)) C code that implements it.

The code is rather straight forward. There are a few chances to do things
faster or more graceful. I don't know how useful my assumptions about
typical usage are (see rrc2_(de|en)crypt). It has been tested on an i486
Linux box using gcc.

Functions intended for users are rrc2_encrypt and rrc2_decrypt. 

The code makes a few assumptions about endianess, word sizes, and so on. If
these aren't met (e.g. on a different architecture), you still have a
perfectly good cipher (I suppose), but it will not be interoperable with
other RRC2 ciphers. The function rrc2_test tests conformance to the
specification by verifying the word sizes and endianess, the self-made
rotation operators, and the given test vectors.

The code doesn't use global variables, so it should be thread-safe.

The code may easily be modified to make a new cipher by changing the type
definitions, or the constants in rrc2_consts.c.


I learned:
- implementation of a cipher is not too hard,
- I really hate C,
- I have no idea what exactly the cipher does, and why it does so.

Plans:
- make the code endian neutral,
- do a "performance" upgrade,
- do a (Turbo-) Pascal version (which I should have done right away),
- do a "performance" upgrade,
- clean up the source code, 
- buy a good book about cryptography, and
- read it.


If anybody can make use of this, I'd appreciate a note.

Sincerely,

Daniel Vogelheim
Aachen, 15.02.95
