Re: Testing XTEA

Mike Simpson wrote:
"Mike Amling" <spamonly@xxxxxxxxxxx> wrote in message news:ene34i$6v6@xxxxxxxxxxxxxxxxxxxxxxxxxx
Mike Simpson wrote:
Thanks Mike, Woolfgang and Tom. The program works well with your plaintexts and cyphertexts, but I still don't get anything meaningfule with the Keith Lockstone vectors - so the problem must be my understanding of those vectors.
Forgive my ignorance, but what are the Keith Lockstone vectors? I may have missed a post somewhere.

--Mike Amling

Mentioned in several of the sites I came across when trying to find some way of checking that my
program was giving the right result. URL is

Note that the code on that web page does not compile. In the tean() function, the first "else" needs a closing brace in front of it. But once that's done it does produce the XTEA output claimed.
I confirmed those XTEA results using the following small Java program.

int[] pz=new int[6], key=new int[4];
for (int jj=1; jj<=64; ++jj) {
System.arraycopy(pz, 2, key, 0, 4);
XTEA.encipher(pz, key, jj);
if ((jj & -jj)==jj) {
int save=pz[0];
System.arraycopy(pz, 1, pz, 0, 5);

Notes: It's a little odd to vary the XTEA iteration count rather than just use 32. hexdump() is a utility I wrote. The last three lines in the loop do a Rotate-Left of pz's six elements.
000000 .....7y......... 00000000 9E3779B9 00000000 00000000
000010 ........ 00000000 00000000
000000 ......%m........ EC01A1DE AAA0256D 00000000 00000000
000010 ........ 00000000 00000000
000000 .:}.N#.......... BC3A7DE2 4E238EB9 00000000 00000000
000010 .....Omt EC01A1DE 114F6D74
000000 1..l$.V..:}..XF. 31C5FA6C 241756D6 BC3A7DE2 845846CF
000010 '..'k... 2794A127 6B8EA8B8
000000 1D8E6992 9A478905 6A1D78C8 08C86D67
000010 *e....nF 2A65BFBE B4BD6E46
000000 .d(.. ".'....... D26428AF 0A202283 27F917B1 C1DA8993
000010 `......= 60E2ACAA A6EB923D
000000 z....=`hb. ...z. 7A01CBC9 B03D6068 62EE209F 069B7AFC
000010 7j.6...# 376A8936 CDC9E923


--Mike Amling