Skip to Content
oxcrypto
Block ciphersLegacy ciphers

XTEA

XTEA block cipher selector.

from oxcrypto.cipher.xtea import XTEA
from oxcrypto.cipher.hazmat import decrypt_block, encrypt_block

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

Warning

Legacy: XTEA has 64-bit blocks. Use it only to read or produce data for existing formats.

Variants: XTEA.XTEA.

Standard: Needham and Wheeler (1997); not standardized.

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