|
Article on other languages:
|
In cryptography, XTEA (eXtended TEA) is a block cipher designed to correct weaknesses in TEA. The cipher's designers were David Wheeler and Roger Needham of the Cambridge Computer Laboratory, and the algorithm was presented in an unpublished technical report in 1997 (Needham and Wheeler, 1997). It is not subject to any patents. Like TEA, XTEA is a 64-bit block Feistel network with a 128-bit key and a suggested 64 rounds. Several differences from TEA are apparent, including a somewhat more complex key-schedule and a rearrangement of the shifts, XORs, and additions. Presented along with XTEA was a variable-width block cipher termed Block TEA, which uses the XTEA round function but applies it cyclically across an entire message for several iterations. Because it operates on the entire message, Block TEA has the property that it does not need a mode of operation. An attack on the full Block TEA was described in (Saarinen, 1998), which also details a weakness in Block TEA's successor, XXTEA. As of 2004, the best attack reported on XTEA is a related-key differential attack on 26 out of 64 rounds of XTEA, requiring 220.5 chosen plaintexts and a time complexity of 2115.15 (Ko et al, 2004). The unusually small size of the XTEA 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.
ImplementationsThis standard C source code, released into the public domain by David Wheeler and Roger Needham, encrypts and decrypts using XTEA: void encipher(unsigned int num_rounds, unsigned long* v, unsigned long* k) { unsigned long v0=v[0], v1=v[1], i; unsigned long sum=0, delta=0x9E3779B9; for(i=0; i<num_rounds; i++) { v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); sum += delta; v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]); } v[0]=v0; v[1]=v1; } void decipher(unsigned int num_rounds, unsigned long* v, unsigned long* k) { unsigned long v0=v[0], v1=v[1], i; unsigned long delta=0x9E3779B9, sum=delta*num_rounds; for(i=0; i<num_rounds; i++) { v1 -= (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]); sum -= delta; v0 -= (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); } v[0]=v0; v[1]=v1; } This code is not 64-bit clean: it will operate incorrectly (and in 128-bit blocks) on platforms where unsigned longs are 64 bits. If portability is a concern, these must be changed to a guaranteed 32-bit type, such as uint32_t from stdint.h. In Java, use the data type 'int' and the operator >>> instead of >>. The recommended value for the "num_rounds" parameter is 32, not 64, as each iteration of the loop does two Feistel-network rounds. To additionally improve speed, the loop can be unrolled by pre-computing the values of sum+k[]. See also
References
External links
|
|||||||||||||||||||||||||||||||||||||||||||
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.
Mercedes Car
This site monitored by SitePinger.net