TEA
The Tiny Encryption Algorithm: a minimal 64-bit Feistel cipher in a few lines of code
Experimental or unclassified. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About TEA
TEA is a block cipher. It uses a 16-byte (128-bit) key and an 8-byte (64-bit) block. NextSSL lists it in the research tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
TEA is a 64-bit block cipher with a 128-bit key designed by David Wheeler and Roger Needham in 1994. Its appeal was its tiny code size, but it has serious key-schedule weaknesses.
TEA is a Feistel network of 64 rounds, usually described as 32 cycles. Each round updates one 32-bit half with a combination of shifts, additions with key words, XOR and a multiple of the golden-ratio constant 0x9E3779B9. There are no S-boxes and no real key schedule: key words are used directly in a fixed pattern.
NextSSL includes TEA for research and legacy interoperability. TEA's tiny code size still makes it attractive in embedded firmware, which is why it continues to appear in reverse-engineering work. Its weaknesses are well documented, and its successors XTEA and XXTEA were designed to address them, with mixed success. Its 64-bit block means that no more than a few gigabytes should be encrypted under a single key, since block collisions become likely around 2^32 blocks.
History
1994–1994TEA published by David Wheeler, Roger Needham
Security notes
TEA has equivalent keys, so its effective key length is 126 bits, and it is vulnerable to related-key attacks. This weakness was exploited to break the Xbox's TEA-based boot integrity check. XTEA fixes some issues; neither should be used in new designs.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 | Secret key |
| block | 8 | Block |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'research' is reachable from the root API only
block = root.call("blockcipher_encrypt", "tea", None, key, plaintext_block)[0]
nextssl_root_blockcipher_encrypt("tea", NULL, key, block, out); /* exactly one block */
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_blockcipher_in(reg::all(), Policy::Any, "tea", &Params::new())?;
let out = alg.encrypt_block(&key, &block)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?More block ciphers
All 84Frequently asked questions
What is TEA?
TEA is a block cipher in the TEA family. TEA is a 64-bit block cipher with a 128-bit key designed by David Wheeler and Roger Needham in 1994.
What are the TEA sizes?
In NextSSL, TEA uses: key 16 bytes, block 8 bytes.
Who designed TEA and when?
TEA belongs to the TEA family, first published in 1994 by David Wheeler, Roger Needham.
Is TEA safe to use?
TEA is in the research tier. Experimental or unclassified. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).