In cryptography, the Tiny Encryption Algorithm (TEA) is a block cipher notable for its simplicity of description and implementation, typically a few lines of code. It was designed by David Wheeler and Roger Needham of the Cambridge Computer Laboratory; it was first presented at the Fast Software Encryption workshop in Leuven in 1994, and first published in the proceedings of that workshop.^{[1]}
The cipher is not subject to any patents.
PropertiesEdit
TEA operates on 64bit blocks and uses a 128bit key. It has a Feistel structure with a suggested 64 rounds, typically implemented in pairs termed cycles. It has an extremely simple key schedule, mixing all of the key material in exactly the same way for each cycle. Different multiples of a magic constant are used to prevent simple attacks based on the symmetry of the rounds. The magic constant, 2654435769 or 9E3779B9_{16} is chosen to be 2^{32}/ϕ, where ϕ is the golden ratio.^{[2]}
TEA has a few weaknesses. Most notably, it suffers from equivalent keys—each key is equivalent to three others, which means that the effective key size is only 126 bits.^{[3]} As a result, TEA is especially bad as a cryptographic hash function. This weakness led to a method for hacking Microsoft's Xbox game console, where the cipher was used as a hash function.^{[4]} TEA is also susceptible to a relatedkey attack which requires 2^{23} chosen plaintexts under a relatedkey pair, with 2^{32} time complexity.^{[5]} Because of these weaknesses, the XTEA cipher was designed.
VersionsEdit
The first published version of TEA was supplemented by a second version that incorporated extensions to make it more secure. Block TEA (sometimes referred to as XTEA) operates on arbitrarysize blocks in place of the 64bit blocks of the original.
A third version (XXTEA), published in 1998, described further improvements for enhancing the security of the Block TEA algorithm.
Reference codeEdit
Template:SectOR Following is an adaptation of the reference encryption and decryption routines in C, released into the public domain by David Wheeler and Roger Needham:
#include <stdint.h> void encrypt (uint32_t* v, uint32_t* k) { uint32_t v0=v[0], v1=v[1], sum=0, i; /* set up */ uint32_t delta=0x9e3779b9; /* a key schedule constant */ uint32_t k0=k[0], k1=k[1], k2=k[2], k3=k[3]; /* cache key */ for (i=0; i < 32; i++) { /* basic cycle start */ sum += delta; v0 += ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1); v1 += ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3); } /* end cycle */ v[0]=v0; v[1]=v1; } void decrypt (uint32_t* v, uint32_t* k) { uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i; /* set up */ uint32_t delta=0x9e3779b9; /* a key schedule constant */ uint32_t k0=k[0], k1=k[1], k2=k[2], k3=k[3]; /* cache key */ for (i=0; i<32; i++) { /* basic cycle start */ v1 = ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3); v0 = ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1); sum = delta; } /* end cycle */ v[0]=v0; v[1]=v1; }
Note that the reference implementation is bound to a specific processor microarchitecture meaning that byte order considerations are important when ciphertext is shared and processed on different systems. The original paper does not specify any details about microprocessor architecture and so anyone implementing a system using TEA would need to make those specifications for themselves.
See alsoEdit
 RC4  A stream cipher that, just like TEA, is designed to be very simple to implement.
 XTEA  First version of Block TEA's successor.
 XXTEA  Corrected Block TEA's successor.
NotesEdit
 ↑ Template:Cite journal
 ↑ Template:Cite journal
 ↑ Template:Cite journal
 ↑ Template:Cite web
 ↑ Template:Cite journal
ReferencesEdit
 Template:Cite paper
 Template:Cite journal
 Template:Cite journal
 Template:Cite journal
 Template:Cite journal
 Template:Cite journal
External linksEdit
 A Cryptanalysis of the Tiny Encryption Algorithm
 A web page advocating TEA and providing a variety of implementations
 Test vectors for TEA
 A survey of TEA and XTEA and their cryptanalysis
 JavaScript implementation of XXTEA with Base64
 PHP implementation of XTEA
 JavaScript implementation of TEA
 JavaScript and PHP implementations of XTEA (English text)
 Ruby implementation of XXTEA with Base64
 LGPL Java/J2ME implementation of TEA
 Visual Basic.NET implementation of TEA

es:Tiny Encryption Algorithm fr:Tiny Encryption Algorithm it:Tiny Encryption Algorithm pl:TEA (kryptografia) ru:TEA