Tiny_Encryption_Algorithm Tiny_Encryption_Algorithm

Tiny Encryption Algorithm - Definition and Overview

This article is about the TEA encryption algorithm. For other meanings, see TEA (disambiguation).
Two rounds of the TEA block cipher
Two rounds of the TEA block cipher

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). The cipher's designers were David Wheeler and Roger Needham of the Cambridge Computer Laboratory, and the algorithm was first presented at the Fast Software Encryption workshop in 1994 (Wheeler and Needham, 1994). It is not subject to any patents.

TEA operates on 64-bit blocks and uses a 128-bit 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.

TEA has a few weaknesses. Most notably, it suffers from equivalent keys — each key is equivalent to three others, and this means that the effective key size is only 126 bits (Kelsey et. al., 1996). This weakness led to a method for hacking Microsoft's Xbox game console, where the cipher was used as a hash function. TEA is also susceptible to a related-key attack which requires 223 chosen plaintexts under a related-key pair, with 232 time complexity (Kelsey et. al., 1997).

Because of these weaknesses, a number of revisions of TEA have been designed, including XTEA.


Reference code

Following is an adaptation of the reference encryption and decryption routines, released into the public domain by David Wheeler and Roger Needham:

 void encrypt(unsigned long* v, unsigned long* k) {
     unsigned long v0=v[0], v1=v[1], sum=0, i;           /* set up */
     unsigned long delta=0x9e3779b9;                     /* a key schedule constant */
     unsigned long 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(unsigned long* v, unsigned long* k) {
     unsigned long v0=v[0], v1=v[1], sum=0xC6EF3720, i;  /* set up */
     unsigned long delta=0x9e3779b9;                     /* a key schedule constant */
     unsigned long 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;
 }

References

  • David J. Wheeler and Roger M. Needham. TEA, a tiny encryption algorithm. In Bart Preneel, editor, Fast Software Encryption: Second International Workshop, volume 1008 of Lecture Notes in Computer Science, pages 363-366, Leuven, Belgium, 14–16 December 1994.
  • John Kelsey, Bruce Schneier, and David Wagner. Key-schedule cryptanalysis of IDEA, G-DES, GOST, SAFER, and Triple-DES. Lecture Notes in Computer Science, 1109: 237–251, 1996.
  • John Kelsey, Bruce Schneier, and David Wagner. Related-key cryptanalysis of 3-WAY, Biham-DES, CAST, DES-X NewDES, RC2, and TEA. Lecture Notes in Computer Science, 1334: pp233–246, 1997.

External links


Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.