Hello,

this is the second revision of my RRC.2 implementation. 


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 word sizes. 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 RRC.2 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.

You need to define symbols LITTLE_ENDIAN or BIG_ENDIAN, depending on the
target machine, of course. Function rrc2_test will verify you chose the
correct setting.

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.

Improvments already done:
- make the code endian neutral,
- do a (Turbo-) Pascal version (which I should have done right away)

Plans:
- do a "performance" upgrade,
- clean up the source code, 
- buy a good book about cryptography, and
- read it.


I'd like to emphasize that the code was written entirely from the spec
posted by Peter Gutmann. I have never seen code of any RSA cipher, including
"RC2". I am living, working and programming in the Federal Repulic of
Germany, which is neither a part of the United States of America nor subject
to the latter's legislation or jurisdiction.


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

Sincerely,

Daniel Vogelheim
