<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Tiny_Encryption_Algorithm</id>
	<title>Tiny Encryption Algorithm - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Tiny_Encryption_Algorithm"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Tiny_Encryption_Algorithm&amp;action=history"/>
	<updated>2026-04-10T03:06:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Tiny_Encryption_Algorithm&amp;diff=324228&amp;oldid=prev</id>
		<title>imported&gt;Kylras: /* growthexperiments-addlink-summary-summary:1|1|0 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Tiny_Encryption_Algorithm&amp;diff=324228&amp;oldid=prev"/>
		<updated>2025-07-01T16:09:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;growthexperiments-addlink-summary-summary:1|1|0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Block cipher}}&lt;br /&gt;
{{About-distinguish-text|the Tiny Encryption Algorithm|the [[Terrestrial Trunked Radio#Air interface encryption|TETRA encryption algorithm]]}}{{Use dmy dates|date=April 2022}}&lt;br /&gt;
{{Infobox block cipher&lt;br /&gt;
| name          = TEA&lt;br /&gt;
| image         = [[Image:TEA InfoBox Diagram.png|250px|center]]&lt;br /&gt;
| caption       = Two Feistel rounds (one cycle) of TEA&amp;lt;ref&amp;gt;{{cite web|title=Tinyness: An Overview of TEA and Related Ciphers|author=Matthew D. Russell|date=27 Feb 2004|url=http://www-users.cs.york.ac.uk/~matthew/TEA/ |archive-url=https://web.archive.org/web/20070812222155/http://www-users.cs.york.ac.uk/~matthew/TEA/ |archive-date=12 August 2007}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| designers     = [[Roger Needham]], [[David Wheeler (computer scientist)|David Wheeler]]&lt;br /&gt;
| publish date  = 1994&lt;br /&gt;
| derived from  = &lt;br /&gt;
| derived to    = [[XTEA]]&lt;br /&gt;
| key size      = 128 bits&lt;br /&gt;
| block size    = 64 bits&lt;br /&gt;
| structure     = [[Feistel network]]&lt;br /&gt;
| rounds        = variable; recommended 64 Feistel rounds (32 cycles)&lt;br /&gt;
| cryptanalysis = TEA suffers from equivalent keys (see text; Kelsey et al., 1996) and can be broken using a [[related-key attack]] requiring 2&amp;lt;sup&amp;gt;23&amp;lt;/sup&amp;gt; [[chosen plaintext]]s and a time complexity of 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;.&amp;lt;ref name=&amp;quot;kelsey1997&amp;quot; /&amp;gt; The best structural cryptanalysis of TEA in the standard single secret key setting is the zero-correlation cryptanalysis breaking 21 rounds in 2&amp;lt;sup&amp;gt;121.5&amp;lt;/sup&amp;gt; time with less than the full code book &amp;lt;ref name=&amp;quot;bogdanovwang2012&amp;quot;&amp;gt;{{cite book | first = Andrey | last = Bogdanov |author2=Wang, Meiqin  | title = Fast Software Encryption | chapter = Zero Correlation Linear Cryptanalysis with Reduced Data Complexity | series = Lecture Notes in Computer Science | volume =  7549 | pages = 29–48 | year = 2012 | url = http://www2.compute.dtu.dk/~anbog/fse12-zerocorrelation.pdf | doi = 10.1007/978-3-642-34047-5_3| isbn = 978-3-642-34046-8 }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In [[cryptography]], the &amp;#039;&amp;#039;&amp;#039;Tiny Encryption Algorithm&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;TEA&amp;#039;&amp;#039;&amp;#039;) is a [[block cipher]] notable for its simplicity of description and [[implementation]], typically a few lines of code. It was designed by [[David Wheeler (computer scientist)|David Wheeler]] and [[Roger Needham]] of the [[Cambridge University Computer Laboratory|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.&amp;lt;ref name=&amp;quot;teapaper&amp;quot;&amp;gt;{{cite book | first = David J. | last = Wheeler |author2=Needham, Roger M.  | title = Fast Software Encryption | chapter = TEA, a tiny encryption algorithm | series = Lecture Notes in Computer Science | &lt;br /&gt;
url = http://citeseer.ist.psu.edu/viewdoc/download;jsessionid=C08E8409ADF484095568965A1EBF3E5E?doi=10.1.1.45.281&amp;amp;rep=rep1&amp;amp;type=pdf | &lt;br /&gt;
volume = 1008 | &lt;br /&gt;
pages = 363–366 | &lt;br /&gt;
location = Leuven, Belgium | date = 1994-12-16 | doi=10.1007/3-540-60590-8_29| isbn = 978-3-540-60590-4 }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cipher is not subject to any [[patent]]s.&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
&lt;br /&gt;
TEA operates on two 32-bit [[unsigned integers]] (could be derived from a 64-bit data [[block size (cryptography)|block]]) and uses a 128-bit  [[key (cryptography)|key]]. It has a [[Feistel network|Feistel structure]] with a suggested 64 rounds, typically implemented in pairs termed &amp;#039;&amp;#039;cycles&amp;#039;&amp;#039;. 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 number (programming)|magic constant]] are used to prevent simple attacks based on the [[symmetry]] of the rounds. The magic constant, 2654435769 or 0x9E3779B9 is chosen to be {{math|⌊2{{sup|32}}{{fraction}}{{phi}}⌋}}, where {{math|{{phi}}}} is the [[golden ratio]] (as a [[nothing-up-my-sleeve number]]).&amp;lt;ref name=&amp;quot;teapaper&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 [[bit]]s.&amp;lt;ref name=&amp;quot;kelsey1996&amp;quot;&amp;gt;{{cite book |first1=John |last1=Kelsey |last2=Schneier |first2=Bruce |author-link2=Bruce Schneier |last3=Wagner |first3=David |title=Advances in Cryptology — CRYPTO &amp;#039;96 |chapter=Key-Schedule Cryptanalysis of IDEA, G-DES, GOST, SAFER, and Triple-DES |series=Lecture Notes in Computer Science |url=http://www.schneier.com/paper-key-schedule.pdf |volume=1109 |pages=237–251 |year=1996 |doi=10.1007/3-540-68697-5_19 |isbn=978-3-540-61512-5 |access-date=25 February 2008 |archive-date=8 February 2012 |archive-url=https://web.archive.org/web/20120208081900/http://www.schneier.com/paper-key-schedule.pdf |url-status=dead }}&amp;lt;/ref&amp;gt; As a result, TEA is especially bad as a [[cryptographic hash function]]. This weakness led to a method for [[Hacker (hobbyist)|hacking]] [[Microsoft]]&amp;#039;s [[Xbox (console)|Xbox]] [[game console]], where the cipher was used as a hash function.&amp;lt;ref&amp;gt;{{cite web |url=http://www.xbox-linux.org/wiki/17_Mistakes_Microsoft_Made_in_the_Xbox_Security_System#Startup_Security.2C_Take_Two |title=17 Mistakes Microsoft Made in the Xbox Security System |author=Michael Steil |archive-url=https://web.archive.org/web/20090416175601/http://www.xbox-linux.org/wiki/17_Mistakes_Microsoft_Made_in_the_Xbox_Security_System |archive-date=16 April 2009}}&amp;lt;/ref&amp;gt; TEA is also susceptible to a [[related-key attack]] which requires 2&amp;lt;sup&amp;gt;23&amp;lt;/sup&amp;gt; [[chosen plaintext]]s under a related-key pair, with 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt; time complexity.&amp;lt;ref name=&amp;quot;kelsey1997&amp;quot;&amp;gt;{{cite book |first1=John |last1=Kelsey |last2=Schneier |first2=Bruce |author-link2=Bruce Schneier |last3=Wagner |first3=David |title=Information and Communications Security |chapter=Related-key cryptanalysis of 3-WAY, Biham-DES, CAST, DES-X, NewDES, RC2, and TEA |series=Lecture Notes in Computer Science | &lt;br /&gt;
url = http://www.schneier.com/paper-relatedkey.html | &lt;br /&gt;
volume = 1334 | pages = 233–246 | year = 1997 | &lt;br /&gt;
doi = 10.1007/BFb0028479| &lt;br /&gt;
isbn = 978-3-540-63696-0 | &lt;br /&gt;
citeseerx = 10.1.1.35.8112 }}&amp;lt;/ref&amp;gt;  Because of these weaknesses, the [[XTEA]] cipher was designed.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
&lt;br /&gt;
The first published version of TEA was supplemented by a second version that incorporated extensions to make it more secure. &amp;#039;&amp;#039;Block TEA&amp;#039;&amp;#039; (which was specified along with [[XTEA]]) operates on arbitrary-size blocks in place of the 64-bit blocks of the original.&lt;br /&gt;
&lt;br /&gt;
A third version ([[XXTEA]]), published in 1998, described further improvements for enhancing the security of the Block TEA algorithm.&lt;br /&gt;
&lt;br /&gt;
==Reference code==&lt;br /&gt;
&lt;br /&gt;
Following is an adaptation of the reference encryption and decryption routines in [[C (programming language)|C]], released into the public domain by David Wheeler and Roger Needham:&amp;lt;ref name=&amp;quot;teapaper&amp;quot;/&amp;gt;&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdint.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void encrypt (uint32_t v[2], const uint32_t k[4]) {&lt;br /&gt;
    uint32_t v0=v[0], v1=v[1], sum=0, i;           /* set up */&lt;br /&gt;
    uint32_t delta=0x9E3779B9;                     /* a key schedule constant */&lt;br /&gt;
    uint32_t k0=k[0], k1=k[1], k2=k[2], k3=k[3];   /* cache key */&lt;br /&gt;
    for (i=0; i&amp;lt;32; i++) {                         /* basic cycle start */&lt;br /&gt;
        sum += delta;&lt;br /&gt;
        v0 += ((v1&amp;lt;&amp;lt;4) + k0) ^ (v1 + sum) ^ ((v1&amp;gt;&amp;gt;5) + k1);&lt;br /&gt;
        v1 += ((v0&amp;lt;&amp;lt;4) + k2) ^ (v0 + sum) ^ ((v0&amp;gt;&amp;gt;5) + k3);&lt;br /&gt;
    }                                              /* end cycle */&lt;br /&gt;
    v[0]=v0; v[1]=v1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void decrypt (uint32_t v[2], const uint32_t k[4]) {&lt;br /&gt;
    uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i;  /* set up; sum is (delta &amp;lt;&amp;lt; 5) &amp;amp; 0xFFFFFFFF */&lt;br /&gt;
    uint32_t delta=0x9E3779B9;                     /* a key schedule constant */&lt;br /&gt;
    uint32_t k0=k[0], k1=k[1], k2=k[2], k3=k[3];   /* cache key */&lt;br /&gt;
    for (i=0; i&amp;lt;32; i++) {                         /* basic cycle start */&lt;br /&gt;
        v1 -= ((v0&amp;lt;&amp;lt;4) + k2) ^ (v0 + sum) ^ ((v0&amp;gt;&amp;gt;5) + k3);&lt;br /&gt;
        v0 -= ((v1&amp;lt;&amp;lt;4) + k0) ^ (v1 + sum) ^ ((v1&amp;gt;&amp;gt;5) + k1);&lt;br /&gt;
        sum -= delta;&lt;br /&gt;
    }                                              /* end cycle */&lt;br /&gt;
    v[0]=v0; v[1]=v1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that the reference implementation acts on multi-byte numeric values. The original paper does not specify how to derive the numbers it acts on from binary or other content.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[RC4]] – A [[stream cipher]] that, just like TEA, is designed to be very simple to implement.&lt;br /&gt;
* [[XTEA]] – First version of Block TEA&amp;#039;s successor.&lt;br /&gt;
* [[XXTEA]] – Corrected Block TEA&amp;#039;s successor.&lt;br /&gt;
* [[Treyfer]] – A simple and compact encryption algorithm with 64-bit key size and block size.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* {{cite web | first = Vikram Reddy | last = Andem | title = A Cryptanalysis of the Tiny Encryption Algorithm, Masters thesis | publisher = The University of Alabama | location = Tuscaloosa | year = 2003 | url = https://www.tayloredge.com/reference/Mathematics/VRAndem.pdf}}&lt;br /&gt;
* {{cite book | first = Julio César | last = Hernández |author2=Isasi, Pedro |author3=Ribagorda, Arturo | chapter= An application of genetic algorithms to the cryptoanalysis of one round TEA | title = Proceedings of the 2002 Symposium on Artificial Intelligence and Its Application | year = 2002 |chapter-url = http://www.actapress.com/PDFViewer.aspx?paperId=26972}}&lt;br /&gt;
* {{cite book | doi = 10.1109/CEC.2003.1299943 | first = Julio César | last = Hernández |author2=Sierra, José María |author3=Isasi, Pedro |author4=Ribargorda, Arturo | title = The 2003 Congress on Evolutionary Computation, 2003. CEC &amp;#039;03 | chapter = Finding efficient distinguishers for cryptographic mappings, with an application to the block cipher TEA | volume = 3 | pages = 2189–2193 | year = 2003 | hdl = 10016/3944 | isbn = 978-0-7803-7804-9 | s2cid = 62216777 }}&lt;br /&gt;
* {{cite book | first = Julio César | last = Hernández | author2 = Sierra, José María | author3 = Ribagorda, Arturo | author4 = Ramos, Benjamín | author5 = Mex-Perera, J. C.  | title = Cryptography and Coding | chapter = Distinguishing TEA from a Random Permutation: Reduced Round Versions of TEA do Not Have the SAC or do Not Generate Random Numbers | volume = 2260 | pages = 374–377 | year = 2001 | url = http://163.117.174.60/downloads/Publicaciones/2001/HernandezSRRM01.pdf | archive-url = https://web.archive.org/web/20120426091456/http://163.117.174.60/downloads/Publicaciones/2001/HernandezSRRM01.pdf | url-status = dead | archive-date = 2012-04-26 | doi = 10.1007/3-540-45325-3_34 | series = Lecture Notes in Computer Science | isbn = 978-3-540-43026-1 }}&lt;br /&gt;
* {{cite book | first = Dukjae | last = Moon |author2=Hwang, Kyungdeok |author3=Lee, Wonil |author4=Lee, Sangjin |author5=Lim, Jongin | title = Fast Software Encryption | chapter = Impossible Differential Cryptanalysis of Reduced Round XTEA and TEA | series = Lecture Notes in Computer Science | volume =  2365 | pages = 49–60 | year = 2002 | url = https://www.iacr.org/archive/fse2002/23650050/23650050.pdf | doi = 10.1007/3-540-45661-9_4| isbn = 978-3-540-44009-3 }}&lt;br /&gt;
* {{cite book | first = Seokhie | last = Hong |author2=Hong, Deukjo |author3=Ko, Youngdai |author4=Chang, Donghoon |author5=Lee, Wonil |author6= Lee, Sangjin  | title = Information Security and Cryptology - ICISC 2003 | chapter = Differential Cryptanalysis of TEA and XTEA | volume = 2971 | pages = 402–417 | doi = 10.1007/978-3-540-24691-6_30| series = Lecture Notes in Computer Science | date = 2004 | isbn = 978-3-540-21376-5 }}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&amp;lt;!--======================== {{No more links}} ============================&lt;br /&gt;
    | PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. Wikipedia  |&lt;br /&gt;
    | is not a collection of links nor should it be used for advertising. |&lt;br /&gt;
    |                                                                     |&lt;br /&gt;
    |           Excessive or inappropriate links WILL BE DELETED.         |&lt;br /&gt;
    | See [[Wikipedia:External links]] &amp;amp; [[Wikipedia:Spam]] for details.  |&lt;br /&gt;
    |                                                                     |&lt;br /&gt;
    | If there are already plentiful links, please propose additions or   |&lt;br /&gt;
    | replacements on this article&amp;#039;s discussion page, or submit your link |&lt;br /&gt;
    | to the relevant category at the Open Directory Project (dmoz.org)   |&lt;br /&gt;
    | and link back to that category using the {{dmoz}} template.         |&lt;br /&gt;
======================={{No more links}}=============================--&amp;gt;&lt;br /&gt;
* [http://www.cix.co.uk/~klockstone/teavect.htm Test vectors for TEA]&lt;br /&gt;
* [http://www.farfarfar.com/scripts/encrypt/ JavaScript implementation of XXTEA with Base64] {{Webarchive|url=https://web.archive.org/web/20060428132257/http://www.farfarfar.com/scripts/encrypt/ |date=28 April 2006 }}&lt;br /&gt;
* [http://www.php-einfach.de/sonstiges_generator_xtea.php PHP implementation of XTEA (German language)]&lt;br /&gt;
* [http://www.movable-type.co.uk/scripts/tea-block.html JavaScript implementation of XXTEA]&lt;br /&gt;
* [http://www.babelfish.nl/?view=actTEA JavaScript and PHP implementations of XTEA (Dutch text)]&lt;br /&gt;
* [https://code.google.com/p/tea-asm-avr/ AVR ASM implementation]&lt;br /&gt;
* [http://cba.mit.edu/docs/papers/05.07.SEA.pdf SEA Scalable Encryption Algorithm for Small Embedded Applications (Standaert, Piret, Gershenfeld, Quisquater - July 2005 UCL Belgium &amp;amp; MIT USA)]&lt;br /&gt;
{{Cryptography navbox | block}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Broken block ciphers]]&lt;br /&gt;
[[Category:Computer security in the United Kingdom]]&lt;br /&gt;
[[Category:Feistel ciphers]]&lt;br /&gt;
[[Category:Free ciphers]]&lt;br /&gt;
[[Category:History of computing in the United Kingdom]]&lt;br /&gt;
[[Category:University of Cambridge Computer Laboratory]]&lt;br /&gt;
[[Category:Articles with example C code]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Kylras</name></author>
	</entry>
</feed>