Article View: sci.crypt
Article #5051Re: TEA problems with temporarely created variables ?
From: Skybuck Flying
Date: Tue, 27 Aug 2002 02:43
Date: Tue, 27 Aug 2002 02:43
93 lines
3729 bytes
3729 bytes
Nope
Spoke to soon..
This code does not seem to work... hehe
void encipher_ext(unsigned long *const v,unsigned long *const w,
const unsigned long *const k)
{
register unsigned long y=v[0],z=v[1],sum=0,delta=0x9E3779B9,n=32;
while(n-->0)
{
y = (y + ( (z << 4) ^ (z >> 5) ) + z) ^ (sum + k[ sum & 3 ]);
// y+= (z<<4 ^ z>>5) + z ^ sum + k[sum&3];
sum += delta;
// z+= (y<<4 ^ y>>5) + y ^ sum + k[sum>>11 & 3];
z = (z + ( (y << 4) ^ (y >> 5) ) + y) ^ (sum + k[ (sum >> 11) & 3]);
}
w[0]=y; w[1]=z;
}
void decipher_ext(unsigned long *const v,unsigned long *const w,
const unsigned long *const k)
{
register unsigned long y=v[0],z=v[1],sum=0xC6EF3720,
delta=0x9E3779B9,n=32;
/* sum = delta<<5, in general sum = delta * n */
while(n-->0)
{
// z-= (y<<4 ^ y>>5) + y ^ sum + k[sum>>11 & 3];
z = (z + ( (y << 4) ^ (y >> 5) ) + y) ^ (sum + k[ (sum >> 11) & 3]);
sum -= delta;
// y-= (z<<4 ^ z>>5) + z ^ sum + k[sum&3];
y = (y + ( (z << 4) ^ (z >> 5) ) + z) ^ (sum + k[ sum & 3 ]);
}
w[0]=y; w[1]=z;
}
<disastry@saiknes.lv.NO.SPaM.NET> wrote in message
news:3D69F6F6.E43591E6@saiknes.lv.NO.SPaM.NET...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> skybuck wrote:
> > The problems are probably with these lines of code:
> >
> > c version:
> >
> > y += (z<<4)+a ^ z+sum ^ (z>>5)+b;
> > z += (y<<4)+c ^ y+sum ^ (y>>5)+d;
> >
> > pascal version:
> >
> > y := y + (z shl 4) + a xor z + _sum xor (z shr 5) + b;
> > z := z + (y shl 4) + c xor y + _sum xor (y shr 5) + d;
>
> 1) try:
> y := y + ((z shl 4) + a xor z + _sum xor (z shr 5) + b);
> or even
> y := y + (((z shl 4) + a) xor (z + _sum) xor ((z shr 5) + b));
>
> 2) better use XTEA (aka (TEAN)
>
> __
> Disastry http://disastry.dhs.org/
> http://disastry.dhs.org/pgp <----PGP plugins for Netscape and MDaemon
> ^----PGP 2.6.3ia-multi06 (supports IDEA, CAST5, BLOWFISH, TWOFISH,
> AES, 3DES ciphers and MD5, SHA1, RIPEMD160, SHA2 hashes)
> -----BEGIN PGP SIGNATURE-----
> Version: Netscape PGP half-Plugin 0.15 by Disastry / PGPsdk v1.7.1
>
> iQA/AwUBPWnayDBaTVEuJQxkEQMpGACfZIT4l3qmDgc6vFEefc8IaltkSfAAoLXz
> hQBQJElRGLhZ0OyB59/rQvpn
> =ouN1
> -----END PGP SIGNATURE-----
Technical Details
Message-ID:
<ZxBa9.3390$28.525677@zwoll1.home.nl>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!newshub1.nl.home.com!news.nl.home.com!zwoll1.home.nl.POSTED!not-for-mailReferences:
<65fc3031.0208260053.300165ba@posting.google.com> <3D69F6F6.E43591E6@saiknes.lv.NO.SPaM.NET>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1043cf,ddba2a7b81ed925a X-Google-Attributes: gid1043cf,public X-Google-Thread: 10cc59,ddba2a7b81ed925a X-Google-Attributes: gid10cc59,public X-Google-Thread: 1014db,ddba2a7b81ed925a X-Google-Attributes: gid1014db,public X-Google-Thread: fb57f,ddba2a7b81ed925a X-Google-Attributes: gidfb57f,public X-Google-ArrivalTime: 2002-08-26 19:44:23 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!newshub1.nl.home.com!news.nl.home.com!zwoll1.home.nl.POSTED!not-for-mail From: "Skybuck Flying" <skybuck2000@hotmail.com> Newsgroups: sci.crypt,comp.lang.pascal,borland.public.delphi.objectpascal,comp.lang.c References: <65fc3031.0208260053.300165ba@posting.google.com> <3D69F6F6.E43591E6@saiknes.lv.NO.SPaM.NET> Subject: Re: TEA problems with temporarely created variables ? Lines: 95 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <ZxBa9.3390$28.525677@zwoll1.home.nl> Date: Tue, 27 Aug 2002 04:43:52 +0200 NNTP-Posting-Host: 217.121.93.57 X-Complaints-To: abuse@home.nl X-Trace: zwoll1.home.nl 1030415609 217.121.93.57 (Tue, 27 Aug 2002 04:33:29 MEST) NNTP-Posting-Date: Tue, 27 Aug 2002 04:33:29 MEST Organization: @Home Network