Sorry for a bit late reply, I'm quite out of time lately... :?

Quote Originally Posted by Sly
In CipherDataXTEA, the loop will not execute at all for strings with less than 8 characters. It will also not encrypt any remaining bytes after the last eight-byte block. The same goes for DecipherDataXTEA.
Yes, I'm not using padding at all. The code assumes that data block is a multiple of 8 bytes.

Quote Originally Posted by Sly
Also, and this might affect both, I believe that the C >> operator is a logical shift (bits fall off the end) and the Delphi shr operator is an arithmetic shift (bits wrap around). I seem to remember we found this when porting Quake 2 to Delphi.
If you look at C source code posted on Wikipedia web page, you will notice that they use UNSIGNED LONG. In that case, ">>" operator is translated to unsigned binary shift, which equals to "shr" in Delphi. The Pascal code is correct.

Anywhere else: if you need to use SIGNED SHIFT in Delphi, you may try to use power-of-two division instead, which will be replaced by signed binary shift (with Optimizations ON). It's not exactly equivalent though, since Delphi adds bias before shift. E.g.:
Code:
var
 Test, Test2: Integer;
begin
 Test := $12345678;
 // Test2:= Test sar 4;  -> this is not possible
 Test2:= Test div 16;
end;
The above code gets translated into:
Code:
 mov eax, $12345678
 mov esi, eax
 test esi, esi
 jns @NoBias
 add esi,  $0F
@NoBias:
 sar esi, 4
See Art of Assembly: Chapter Six-3 for more information about how SHR/SAR work and their differences.