The MIX transformation of RC2; four of these comprise a MIXING round
General
Designers : Ron Rivest
First published : leaked in 1996, designed in 1987
Cipher detail
Key sizes : 8–1024 bits, in steps of 8 bits; default 64 bits
Block sizes : 64 bits
Structure : Source-heavy unbalanced Feistel network
Rounds : 16 of type MIXING, 2 of type MASHING
This module implements the RC2 (Rivest's Cipher version 2) encryption algorithm in pure python, specified in RFC 2268.
ECB and CBC modes are supported.
Original source code : https://github.com/0xEBFE/RC2-python/blob/master/rc2.py
Backporting Python 3 Code to Python 2.7.x by koha <kkoha@msn.com>
Quick start
Install from PyPI: https://pip.pypa.io/en/latest/installing.html
pip install rc2
Example RC2 usage
from rc2 import * #RC2 ECB encryption. plaintext = "hello_word_ECB" key = "test key" rc2 = RC2(key) encrypted = rc2.encrypt(plaintext,MODE_ECB) print encrypted.encode('hex') #RC2 ECB decryption. rc2 = RC2(key) decrypted = rc2.decrypt(encrypted,MODE_ECB) print decrypted #RC2 CBC encryption. plaintext = "hello_word_CBC" key = "test key" iv = "\x01\x02\x03\x04\x05\x06\x07\x08" rc2 = RC2(key) encrypted = rc2.encrypt(plaintext,MODE_CBC,iv,PADDING_PKCS5) print encrypted.encode('hex') #RC2 CBC decryption. rc2 = RC2(key) decrypted = rc2.decrypt(encrypted,MODE_CBC,iv,PADDING_PKCS5) print decrypted