The TEA Cipher (Tiny Encryption Algorithm) is a simple and efficient symmetric block cipher designed to be easy to implement while still providing a reasonable level of security. TEA operates on 64-bit blocks of data using a 128-bit key and applies a series of Feistel rounds involving bitwise operations, shifts, and additions. Its compact design makes it popular in constrained environments and educational contexts where understanding the mechanics of encryption is important.

TEA performs encryption through 32 rounds of mixing operations using a constant known as delta, derived from the golden ratio. Unlike more complex ciphers such as AES, TEA focuses on simplicity and speed, though it is not recommended for high-security applications due to known weaknesses. This tool supports encoding and decoding with output formats in Base64 or Hexadecimal.

TEA Cipher: Encoding

With the default configuration:

  • Key: cf8d7c25008c33e3e2f9be84eb668f5c (128-bit)
  • Format: Base64

Encoding the plaintext hello world produces:

Plaintext: hello world
Key:       cf8d7c25008c33e3e2f9be84eb668f5c

Ciphertext (Base64):
yKeSI06GILMN3C9oIpVxQA==

TEA divides the plaintext into 64-bit blocks and applies padding to ensure proper alignment. Each block is processed through multiple rounds of mixing operations using the key, resulting in ciphertext that appears random. The final output is encoded in Base64 for readability.

TEA Cipher: Decoding

Using the same configuration, the ciphertext can be decrypted back into plaintext:

Ciphertext: yKeSI06GILMN3C9oIpVxQA==
Key:        cf8d7c25008c33e3e2f9be84eb668f5c

Plaintext:
hello world

Decoding reverses the encryption process by applying the TEA rounds in reverse order and removing padding. The correct key must be used to recover the original plaintext.

TEA Cipher: Notes

  • Block Size: TEA operates on 64-bit (8-byte) blocks. Input data is padded automatically to fit this size.
  • Key Size: Uses a fixed 128-bit (16-byte) key, normalized internally to the required length.
  • Rounds: TEA performs 32 rounds of encryption, providing diffusion through repeated mixing operations.
  • Padding: Padding is added during encryption and removed during decryption to maintain proper block alignment.
  • Output Format: Base64 is convenient for storage and transmission; Hex provides raw byte-level representation.
  • Security: TEA is simple and fast but has known cryptographic weaknesses, making it more suitable for learning and non-critical use cases rather than secure communications.

The TEA Cipher stands out for its minimalistic design and ease of implementation. While not as secure as modern standards, it remains a useful example of how block ciphers operate and how simple mathematical operations can be combined to produce encrypted data.

TEA Cipher

T
🗝