Skip to Content
oxcrypto

HC-256

Encrypt with the HC-256 stream cipher.

from oxcrypto.stream.hc_256 import HC256

key = bytes(32)
nonce = bytes(32)
ciphertext = HC256.HC256.apply_keystream(key, nonce, b"hello")
assert HC256.HC256.apply_keystream(key, nonce, ciphertext) == b"hello"

HC-256 takes a 32-byte key and a 32-byte nonce. It is in the eSTREAM software portfolio as HC-128's 256-bit companion. The upstream crate cannot seek, so the cipher object has position but no seek, and apply_keystream has no counter.