| 1 |
RC2 |
| 2 |
=== |
| 3 |
|
| 4 |
.. warning:: |
| 5 |
Use :doc:`aes` instead. This module is provided only for legacy purposes. |
| 6 |
|
| 7 |
RC2_ (Rivest's Cipher version 2) is a symmetric block cipher designed |
| 8 |
by Ron Rivest in 1987. The cipher started as a proprietary design, |
| 9 |
that was reverse engineered and anonymously posted on Usenet in 1996. |
| 10 |
For this reason, the algorithm was first called *Alleged* RC2 (ARC2), |
| 11 |
since the company that owned RC2 (RSA Data Inc.) did not confirm whether |
| 12 |
the details leaked into public domain were really correct. |
| 13 |
|
| 14 |
The company eventually published its full specification in RFC2268_. |
| 15 |
|
| 16 |
RC2 has a fixed data block size of 8 bytes. Length of its keys can vary from |
| 17 |
8 to 128 bits. One particular property of RC2 is that the actual |
| 18 |
cryptographic strength of the key (*effective key length*) can be reduced |
| 19 |
via a parameter. |
| 20 |
|
| 21 |
Even though RC2 is not cryptographically broken, it has not been analyzed as |
| 22 |
thoroughly as AES, which is also faster than RC2. |
| 23 |
|
| 24 |
As an example, encryption can be done as follows:: |
| 25 |
|
| 26 |
>>> from Crypto.Cipher import ARC2 |
| 27 |
>>> |
| 28 |
>>> key = b'Sixteen byte key' |
| 29 |
>>> cipher = ARC2.new(key, ARC2.MODE_CFB) |
| 30 |
>>> msg = cipher.iv + cipher.encrypt(b'Attack at dawn') |
| 31 |
|
| 32 |
.. _RC2: http://en.wikipedia.org/wiki/RC2 |
| 33 |
.. _RFC2268: http://tools.ietf.org/html/rfc2268 |
| 34 |
|
| 35 |
.. automodule:: Crypto.Cipher.ARC2 |
| 36 |
:members: |