XTEA
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.
Implementations
This standard C source code, released into the public domain by David Wheeler and Roger Needham, encrypts and decrypts using XTEA:
Related Topics:
C - Public domain
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
void encipher(unsigned long* v, unsigned long* k) {
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
unsigned long v0=v, v1=v, i;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
unsigned long sum=0, delta=0x9E3779B9;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
for(i=0; i
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
v0 += ((v1 > 5) + v1) ^ (sum + k);
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
sum += delta;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
v1 += ((v0 > 5) + v0) ^ (sum + k);
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
v=v0; v=v1;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
void decipher(unsigned long* v, unsigned long* k) {
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
unsigned long v0=v, v1=v, i;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
unsigned long sum=0xC6EF3720, delta=0x9E3779B9;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
for(i=0; i
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
v1 -= ((v0 > 5) + v0) ^ (sum + k);
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
sum -= delta;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
v0 -= ((v1 > 5) + v1) ^ (sum + k);
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
v=v0; v=v1;
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Table of Content ~
| ► | Introduction |
| ► | Implementations |
| ► | References |
| ► | External links |
~ What's Hot ~
~ Community ~
| ► | History Forum Come and discuss about History, Civilizations, Historical Events and Figures |
| ► | History Web-Ring A community of sites, blogs and forums dedicated to History. Do not hesitate to submit your site. |
and are licensed under the GNU Free Documentation License.
Lexicon - Privacy Policy - Spiritus-Temporis.com ©2005.