ArticleslgStudy

computer science

XXTEA

XXTEA is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand XXTEA rather than just read about it. In short: In cryptography, Corrected Block TEA (often referred to as XXTEA) is a block cipher designed to correct weaknesses in the original Block TEA. XXTEA is vulnerable to a chosen-plaintext attack requiring 259 queries and negligible work.

XXTEA — main illustration
XXTEA — illustration

Key takeaways

  • XXTEA belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect XXTEA to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of XXTEA from memory before moving on to harder problems.

Reference excerpt

In cryptography, Corrected Block TEA (often referred to as XXTEA) is a block cipher designed to correct weaknesses in the original Block TEA. XXTEA is vulnerable to a chosen-plaintext attack requiring 259 queries and negligible work. See cryptanalysis below. The cipher's designers were Roger Needham and David Wheeler of the Cambridge Computer Laboratory, and the algorithm was presented in an unpublished technical report in October 1998 (Wheeler and Needham, 1998). It is not subject to any patents. Formally speaking, XXTEA is a consistent incomplete source-heavy heterogeneous UFN (unbalanced Feistel network) block cipher. XXTEA operates on variable-length blocks that are some arbitrary multiple of 32 bits in size (minimum 64 bits). The number of full cycles depends on the block size, but there are at least six (rising to 32 for small block sizes). The original Block TEA applies the XTEA round function to each word in the block and combines it additively with its leftmost neighbour. Slow diffusion rate of the decryption process was immediately exploited to break the cipher. Corrected Block TEA uses a more involved round function which makes use of both immediate neighbours in processing each word in the block. XXTEA is likely to be more efficient than XTEA for longer messages. Needham & Wheeler make the following comments on the use of Block TEA:

For ease of use and general security the large block version is to be preferred when applicable for the following reasons.

A single bit change will change about one half of the bits of the entire block, leaving no place where the changes start. There is no choice of mode involved. Even if the correct usage of always changing the data sent (possibly by a message number) is employed, only identical messages give the same result and the information leakage is minimal. The message number should always be checked as this redundancy is the check against a random message being accepted. Cut and join attacks do not appear to be possible. If it is not acceptable to have very long messages, they can be broken into chunks say of 60 words and chained analogously to the methods used for DES.

However, due to the incomplete nature of the round function, two large ciphertexts of 53 or more 32-bit words identical in all but 12 words can be found by a simple brute-force collision search requiring 296−N memory, 2N time and 2N+296−N chosen plaintexts, in other words with a total time*memory complexity of 296, which is actually 2wordsize*fullcycles/2 for any such cipher. It is currently unknown if such partial collisions pose any threat to the security of the cipher. Eight full cycles would raise the bar for such collision search above complexity of parallel brute-force attacks. The unusually small size of the XXTEA algorithm would make it a viable option in situations where there are extreme constraints e.g. legacy hardware systems (perhaps embedded) where the amount of available RAM is minimal, or alternatively single-board computers such as the Raspberry Pi, Banana Pi or Arduino.

Cryptanalysis An attack published in 2010 by E. Yarrkov presents a chosen-plaintext attack against full-round XXTEA with wide block, requiring 259 queries for a block size of 212 bytes or more, and negligible work. It is based on differential cryptanalysis. To cipher "212 bytes or more" algorithm performs just 6 rounds, and carefully chosen bit patterns allows to detect and analyze avalanche effect.

Reference code The original formulation of the Corrected Block TEA algorithm, published by David Wheeler and Roger Needham, is as follows:

According to Needham and Wheeler:

BTEA will encode or decode n words as a single block where n > 1 v is the n word data vector k is the 4 word key n is negative for decoding if n is zero result is 1 and no coding or decoding takes place, otherwise the result is zero assumes 32 bit 'long' and same endian coding and decoding Note that the initialization of z is Undefined behavior for n < 1 which may cause a segmentation fault or other unwanted behavior – it would be better placed inside the 'Coding Part' block. Also, in the definition of MX some programmers would prefer to use bracketing to clarify operator precedence. A clarified version including those improvements is as follows:

See also RC4: A stream cipher that, just like XXTEA, is designed to be very simple to implement. XTEA: Block TEA's precursor. TEA: XTEA's precursor.

References

External links a JavaScript implementation a PHP implementation a CL implementation

Illustrations

XXTEA illustration

Worked examples

Example 1 — a first encounter with XXTEA

Start with the simplest possible case. Write down what XXTEA claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to XXTEA before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about XXTEA ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of XXTEA

In research
XXTEA appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses XXTEA in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
XXTEA is common in secondary-school and first-year university syllabi. It links to neighbouring topics Block ciphers, Broken block ciphers, Computer security in the United Kingdom, so understanding it makes those chapters shorter.
In everyday life
Look for XXTEA outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “XXTEA” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study XXTEA in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what XXTEA means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain XXTEA out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is XXTEA in simple terms?

In cryptography, Corrected Block TEA (often referred to as XXTEA) is a block cipher designed to correct weaknesses in the original Block TEA. XXTEA is vulnerable to a chosen-plaintext attack requiring 259 queries and negligible work.

Why does XXTEA matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study XXTEA?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on XXTEA.

Tags

  • Block ciphers
  • Broken block ciphers
  • Computer security in the United Kingdom
  • Feistel ciphers
  • History of computing in the United Kingdom
  • Science and technology in Cambridgeshire

Keep exploring