Skip to Content
oxcrypto

RC4

Legacy RC4 for interoperability with existing data.

from oxcrypto.stream.rc4 import RC4

key = b"Key"
ciphertext = RC4.RC4.apply_keystream(key, b"", b"Plaintext")
assert ciphertext.hex() == "bbf316e8d940af0ad3"

Warning

RC4 is broken and prohibited in TLS by RFC 7465. Use it only to read or write existing data. It takes a 1 to 256 byte key and no nonce, so nonce must be empty. The upstream crate cannot seek, so the cipher object has position but no seek.