Skip to Content
oxcrypto

RC5

RC5 block cipher selector.

from oxcrypto.cipher.rc5 import RC5
from oxcrypto.cipher.hazmat import decrypt_block, encrypt_block

cipher = RC5.RC5_64_24_24
key = cipher.generate_key()
block = bytes(cipher.block_size)
assert decrypt_block(key, encrypt_block(key, block, cipher=cipher), cipher=cipher) == block

Variants: RC5.RC5_8_12_4, RC5.RC5_16_16_8, RC5.RC5_32_12_16, RC5.RC5_32_16_16, RC5.RC5_64_24_24.

Standard: RFC 2040. Variant names are word size in bits, rounds and key bytes.

Pass the selector as cipher= to any mode. Raw single-block functions live in oxcrypto.cipher.hazmat.

The RustCrypto block-ciphers README states that this crate is not implemented in constant time and has no published audit. oxcrypto has not verified its timing behavior.