Andrew Warren wrote: > > Dudes: > > A few days ago, someone on the list mentioned TEA (the "Tiny > Encryption Algorithm"), developed by Wheeled and Needham at > Cambridge. I managed it working on Friday night :-) (I have Internet access at work so I don't read mail in the week ends). > I've just thrown together a PIC16 implementation. The PIC isn't > really well-suited for the job -- TEA is optimized for 32-bit > processors with fast barrel-shifters -- but it still manages to > encrypt or decrypt a 64-bit block in about 6600 cycles (which works > out to 6K bytes per second at 20 MHz). I got 6538 cycles for encipher and a little more for decipher (due of the subtractions instead of additions: they are not commutative!). I am sure I can shrink the execution time using ad-hoc shift and add routines instead of the generalized ones I use currently. > If any of you wants a copy, let me know... I've sent my code to Dr. > Simon Shepherd for verification; as soon as he agrees that it's a > correct implementation, I'll be happy to distribute it. If you like I can send you my code while you send me yours... For a quick check: enciphering an all zero's data block using an all zero's key gives a 0xed285da1 0x455b33c1 cipher block. > Some details: > > The "encode" and "decode" routines occupy 275 words of code > space (each occupies about 200 words alone, but they share some > large subroutines). 269 words!! (I win!!! :-))) > 37 bytes of RAM are required: 16 for the 128-bit key, 8 for the > 64-bit plain/ciphertext, and 13 for local variables. Oops. I used the same for the key and plaintext/ciphertext but I waste 17 bytes for local use (I know I can save that 32 bit temp register but I was to tired last Friday...) > I'm thinking of doing a PIC17 version; it should be significantly > faster and MUCH shorter... Is anyone interested? > > Alternatively, is anyone interested in a PIC16 version that'd be > WAY slower, but would fit in fewer than 100 words? Strange. I was thinking of a (maybe) longer but FASTER version. > -Andy > > === Andrew Warren - fastfwd@ix.netcom.com > === Fast Forward Engineering - Vista, California > === http://www.geocities.com/SiliconValley/2499 BTW: if there is someone willing to have my code I can post it here (it is a good practice?) or I can send individual copy. Ciao Marco ---- Marco DI LEO email: m.dileo@sistinf.it Sistemi Informativi S.p.A. tel: +39 6 50292 300 V. Elio Vittorini, 129 fax: +39 6 5015991 I-00144 Roma Italy