Skip to Content
oxcrypto

Threefish

Threefish block cipher selector.

from oxcrypto.cipher.threefish import THREEFISH
from oxcrypto.cipher.hazmat import decrypt_block, encrypt_block

cipher = THREEFISH.THREEFISH1024
key = cipher.generate_key()
block = bytes(cipher.block_size)
assert decrypt_block(key, encrypt_block(key, block, cipher=cipher), cipher=cipher) == block

Variants: THREEFISH.THREEFISH256, THREEFISH.THREEFISH512, THREEFISH.THREEFISH1024.

Standard: The tweakable cipher inside Skein (SHA-3 finalist). This API uses a zero tweak.

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.