Main Site Documentation

Xtea


#1
byte[] XTEA_key = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
        Key_TinyEncryptionAlgorithm xtea = new Key_TinyEncryptionAlgorithm(XTEA_key);
 string original_string = "FEZ is so easy!";
                   
                    byte[] dados = UTF8Encoding.UTF8.GetBytes(original_string);
                    byte[] encrypted_bytes = xtea.Encrypt(dados, 0, dados.Length, null);
                    Debug.Print("-------------------------");
                    Debug.Print(encrypted_bytes[0].ToString());
                    Debug.Print(encrypted_bytes[1].ToString());
                    Debug.Print(encrypted_bytes[2].ToString());
                    Debug.Print(encrypted_bytes[3].ToString());
                    Debug.Print("-------------------------");

Dear Sir, in this code and encript the message FEZ is so easy! and i print the 4 first bytes of encripted data…, that returns
21
172
28
249

Comparing with the Jens Kuhner book
(expert. NET Micro Framework Second Edition)

The example returns differente value…
http://www.inf.furb.br/~maw/asm51/xtea.jpg

Here executable

http://www.inf.furb.br/~maw/asm51/BludataBigBen.exe

May you help me ?

Miguel


#2

Maye Jens implementation is different? Have you tried contacting the book author about this?


#3

Yes

I sent a e-mail few minutes ago.

If you have some link for me to buy and XTEA SOURCE CODE for PC,that is the same algorithm of your MICROFRAMEWORK it will help me.

I want change encripted messages between the PC and USBIZI.

Thanks

Miguel


#4

Jens code should work so I am not sure how I can help


#5

He is not encrypting in the same way as the example …

He is passing null in the 4th parameter:

byte[] encrypted_bytes = xtea.Encrypt(dados, 0, dados.Length, null);

He should be passing a byte array of 8 values (1,2,3,4,5,6,7,8)

-Eric


#6

Yes, you are correct, the 4th parameter is IV and not null. Now it´s equal to Jens and it´s working.
Thanks
Miguel