CoderTools

TEA/XTEA/XXTEA Encryption & Decryption

Tiny Encryption Algorithm Family - Lightweight symmetric block ciphers

Security Notice

TEA/XTEA/XXTEA are lightweight ciphers primarily used in embedded systems and games. For high-security applications, please use AES instead.

All TEA family algorithms use a fixed 128-bit (16 bytes) key.
Format Options

About TEA Family

The TEA (Tiny Encryption Algorithm) family includes three related block ciphers designed by Roger Needham and David Wheeler at Cambridge. TEA was introduced in 1994, XTEA in 1997 to fix weaknesses in TEA, and XXTEA in 1998 as a variable-length block cipher.

These algorithms are known for their simplicity and small code footprint, making them ideal for embedded systems, microcontrollers, and applications where code size is critical. They are particularly popular in game development for encrypting game assets and save files.

Algorithm Comparison

Algorithm Block Size Key Length Rounds Security
TEA 64 bits 128 bits 64 Legacy
XTEA 64 bits 128 bits 64 Good
XXTEA Variable (≥64 bits) 128 bits Variable (6+52/n) Good

Key Features

  • Extremely compact - can be implemented in just a few lines of code
  • 128-bit key provides reasonable security for most applications
  • Fast encryption/decryption on resource-constrained devices
  • No intellectual property restrictions - completely free to use

Encryption Modes (TEA/XTEA only)

  • CBC: Cipher Block Chaining - Each block is XORed with the previous ciphertext block before encryption. Requires IV.
  • ECB: Electronic Codebook - Each block is encrypted independently. Simple but not recommended for most uses.
  • CFB: Cipher Feedback - Turns block cipher into stream cipher. Self-synchronizing mode.
  • OFB: Output Feedback - Generates keystream independently. No error propagation.
  • RAW: Raw Block - Direct single block encryption without any chaining mode. No IV required.

Security Considerations

  • TEA: Has known equivalent keys vulnerability and related-key attacks. Use XTEA or XXTEA instead.
  • XTEA: Fixed TEA's weaknesses with improved key schedule. Widely used and reasonably secure.
  • XXTEA: Operates on variable-length blocks. Better diffusion but some theoretical attacks exist.
  • For applications requiring high security, consider using AES which is the modern industry standard.

Common Use Cases

  • Game asset encryption (Cocos2d-x, Unity game resource protection)
  • IoT device communication encryption
  • Embedded systems with limited memory and processing power
  • Legacy system compatibility and protocol implementations

References

Quick Menu

No recent tools