#include <rc2.h>
Inheritance diagram for RC2:


RC2 is an 8-byte block cipher with a variable length key. It became popular in the late 90's principally due to its adaptability to past government export regulations: one can easily limit the effective keysize to 40 bits. Today it is primarily used to decode old PKCS#12 files and for other legacy purposes.
Usage flow: RC2() // instantiate a new RC2 object init() // specify direction, key, mode, and effective keysize crypt() // perform the encrypt or decrypt operation Bugs: the code does not properly handle 1-byte keys Recommendations for strict FIPS 140-1 compliance: RC2 is not a FIPS approved algorithm, so the RC2 class should *NOT* be used.
Sample code illustrating the use of this class appears in the Cookbook section Using the Symmetric Ciphers.
Public Types | |
| ENCRYPT | |
| crypt() call performs encryption | |
| DECRYPT | |
| crypt() call performs decryption | |
| enum | dirs { ENCRYPT, DECRYPT } |
| Direction flags. More... | |
Public Member Functions | |
| RC2 () | |
| Constructor used to create an empty RC2 object. | |
| ~RC2 () | |
| Destructor. Calls clear(). | |
| int | init (enum dirs dir, int length, const char *key, const char *iv=0, int ekb=1024) |
| Initialize the RC2 object. | |
| int | crypt (int n, const char *in, char *out) |
| Encrypt or decrypt a specified buffer. | |
| void | clear () |
| Clear this object. | |
| enum dirs |
| void clear | ( | ) |
Clear this object.
| int crypt | ( | int | n, | |
| const char * | in, | |||
| char * | out | |||
| ) |
Encrypt or decrypt a specified buffer.
| n | the number of bytes in the input and output buffers | |
| in | a pointer to the input buffer | |
| out | a pointer to the output buffer |
| int init | ( | enum dirs | dir, | |
| int | length, | |||
| const char * | key, | |||
| const char * | iv = 0, |
|||
| int | ekb = 1024 | |||
| ) |
Initialize the RC2 object.
| dir | a direction indicator: ENCRYPT or DECRYPT | |
| length | the length of key in bytes; usually 40 or 128 | |
| key | a pointer to a buffer containing the key | |
| iv | either 0 (for ECB mode) or an 8-byte initialization vector (for CBC mode) | |
| ekb | the number of effective key bits |
| ISC Cryptographic Development Kit - User's Guide | |
| Questions? E-mail ISC technical support | |
| Copyright© 2002-2006 Information Security Corp. All rights reserved. |