← Cryptography guide

K022 / Symmetric ciphers (block and stream)

TEA/XTEA

XTEA Tiny Encryption Algorithm · Survey date 2026-12-05

XTEA is an extended block cipher designed to address weaknesses in TEA.

CRYPTOGRAPHY LAB / K022

Cryptography Lab · TEA/XTEA

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Legacy / non-secure

XTEA (32 cycles)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Open lab →

Definition and overview
XTEA is an extended block cipher designed to address weaknesses in TEA. Source document ↗
Classification and reversibility
Reversible symmetric encryption and decryption with the same key. Source document ↗
Key or secret requirements
Requires a 16-byte (128-bit) symmetric key. Source document ↗
Operating principle and structure
Feistel structure combines addition, XOR and shifts; recommended 64 rounds (32 cycles). Source document ↗
Key size, block size and parameters
64-bit block, 128-bit key, recommended 64 Feistel rounds (32 cycles). Source document ↗
Security strength and recommendation
Legacy cipher; short blocks are vulnerable to birthday attacks, unsuitable for new security uses. Source document ↗
Known attacks and vulnerabilities
Known analyses include related-key rectangle attacks on reduced rounds. Source document ↗
Standards and certification
Classified as a deployed legacy algorithm rather than an adopted standard. Source document ↗
Typical uses
Limited primarily to legacy interoperability. Source document ↗
Implementations, libraries and tools
Implementations include Go x/crypto/xtea and other languages. Source document ↗
Decryption or decoding
Decrypt with the same key, mode and IV used for encryption. Source document ↗
Advantages
Simple implementation and easy portability. Source document ↗
Limitations and cautions
Legacy status and short-block weaknesses warrant avoiding new use. Source document ↗
Distinguishing encryption, encoding and hashing
XTEA is keyed reversible block encryption, distinct from keyless encoding or hashing. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Input an 8-byte plaintext block and 128-bit secret key to produce an XTEA ciphertext block. Do not show actual keys or IVs; generate them with secure randomness.

Procedure

Securely generate/store a 128-bit key, choose mode and IV if needed, pad and encrypt blocks. Decrypt using the same key/mode/IV and remove padding. Base64 is keyless reversible encoding, not XTEA decryption.

Scenario

Restrict to legacy devices/protocols or decryption of existing data. Migrate sensitive data to modern AEAD with key/IV management and integrity verification.

Pitfalls and alternatives

XTEA is legacy and its 64-bit blocks risk birthday attacks; avoid new designs, ECB, key/IV reuse and padding errors. Prefer AES-GCM or XChaCha20-Poly1305.

References