Looking for 'real' encryption? Start here.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 00:40
From: RobbyRacoon Olmstead I guess I need to re-read this entire thread now, cause that prompted a memory (I think so, at least) of someone saying something about LSL not having unsigned integers and having to do a workaround. If that is the case, it's probably not worth the effort to pursue in my case, since XTEA is really overkill for what I needed anyways.
Btw: The Pear class uses 32 cycles by default, and doesn't seem to work right with other values. The unsigned ints did worry me when we tried a quick implementation of TEAI will refund your generous donation when I'm next in world as this has not yet solved the problem.
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
04-18-2007 00:49
From: Newgate Ludd The unsigned ints did worry me when we tried a quick implementation of TEA I will refund your generous donation when I'm next in world as this has not yet solved the problem. Naw, keep it for the time spent 
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 00:52
From: RobbyRacoon Olmstead Naw, keep it for the time spent  TY but I really wouldn't feel right about doing so. Hopefully we can solve this and have something workable soon.
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 05:42
From: someone Try the following
integer KEY1 = 0x33323130; integer KEY2 = 0x37363534; integer KEY3 = 0x62639138; integer KEY4 = 0x66656463; whit those, i have (in 32 cicles): BC9C009B463B6464 i'm becoming crazy for it  I tryed the javascript implemention too, included with thw PEAR xtea package, i have the same php result. If i try to modify something in php, it never decrypt anymore; it seems that i have to adjust in LSL, but really don't know how. If you don't have php, you can try the javascript port in the Pear package: http://download.pear.php.net/package/Crypt_Xtea-1.1.0RC5.tgzI can pay for it and share with the community, please help! 
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
04-18-2007 06:32
From: RobbyRacoon Olmstead I guess I need to re-read this entire thread now, cause that prompted a memory (I think so, at least) of someone saying something about LSL not having unsigned integers and having to do a workaround. If that is the case, it's probably not worth the effort to pursue in my case, since XTEA is really overkill for what I needed anyways.
Btw: The Pear class uses 32 cycles by default, and doesn't seem to work right with other values. PHP also lacks unsigned ints. http://php.net/manual/en/language.types.integer.phpDon't know if that helps any.
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 08:19
i found another class in the PEAR repository named XXTEA. this is the link: http://download.pear.php.net/package/Crypt_XXTEA-0.8.0.tgzand this is my test with it: <?php $key = "0123456789abcdef"; $text = "test"; require_once 'XXTEA.php'; $XXTEA = new Crypt_XXTEA(); $XXTEA->setKey($key); $result=$XXTEA->encrypt($text); $decrypt=$XXTEA->decrypt($result); echo bin2hex($result), "<br />", $decrypt; ?> result: e3ae31f10af427ac test
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 08:25
XXTEA is, if memory serves me right, a further enhanced block TEA encryption system so will give different results for the same input.
We need to get to the bottom of why the LSL implementation and the php implementation give different results. I'll walk my way through the PHP when I get the chance, may be an oppertunity to learn a bit of PHP.
I'll post back here if I make any headway.
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 08:41
I found a really interesting topic here: http://www.answers.com/topic/xteait say: From: someone It is important to note that some modern programming languages have a slightly different operators order of precedence. Therefore, the interpretation of the original code will lead to different results, making different implementations of the encryption incompatible. This can be corrected with the use of a few parenthesis to enforce precedence order.
void encipher(unsigned int num_rounds, unsigned long* v, unsigned long* k) { unsigned long v0=v[0], v1=v[1], i; unsigned long sum=0, delta=0x9E3779B9; for(i=0; i<num_rounds; i++) { v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); sum += delta; v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]); } v[0]=v0; v[1]=v1; } and here is our code in LSL: while (n-- > 0){ dword1 = dword1 + ( ( dword2 << 4 ^ dword2 >> 5 ) + dword2 ^ sum + llList2Integer(cypherkey, (sum & 3) ) ); sum += delta; dword2 = dword2 + ( ( dword1 << 4 ^ dword1 >> 5 ) + dword1 ^ sum + llList2Integer(cypherkey, (sum >> 11 & 3) ) ); } Probably is this???? I can't test now, the grid is down, but is the first thing i try when i can connect 
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 08:52
From: Tobia Forcella I found a really interesting topic here: http://www.answers.com/topic/xteait say: and here is our code in LSL: while (n-- > 0){ dword1 = dword1 + ( ( dword2 << 4 ^ dword2 >> 5 ) + dword2 ^ sum + llList2Integer(cypherkey, (sum & 3) ) ); sum += delta; dword2 = dword2 + ( ( dword1 << 4 ^ dword1 >> 5 ) + dword1 ^ sum + llList2Integer(cypherkey, (sum >> 11 & 3) ) ); } Probably is this???? I can't test now, the grid is down, but is the first thing i try when i can connect  That is what I was refering to in one of my previous posts. I will try to spend some time to investigate but I have a severe lack of free time atm!!!
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 09:19
list TEAEncrypt(integer dword1, integer dword2,list cypherkey) {
list cryptlist = []; //Set n to the number of cycles given in the CYCLES global variable integer n = CYCLES; integer sum = 0; //Operate for the specified number of cycles. while (n-- > 0) { dword1 = dword1 + ( ( (dword2 << 4) ^ (dword2 >> 5) ) + dword2) ^ (sum + llList2Integer(cypherkey, (sum & 3) ) ); sum += delta; dword2 = dword2 + ( ( (dword1 << 4) ^ (dword1 >> 5) ) + dword1) ^ (sum + llList2Integer(cypherkey, ( (sum >> 11) & 3) ) ); } cryptlist = [dword1,dword2];
return cryptlist; }
list TEADecrypt(integer dword1, integer dword2,list cypherkey){ list cryptlist = []; //Set n to the number of cycles given in the CYCLES global variable integer n = CYCLES; integer sum = delta * CYCLES;
//Operate for the specified number of cycles. while (n-- > 0) { dword2 = dword2 - ( ( (dword1 << 4) ^ (dword1 >> 5) ) + dword1) ^ (sum + llList2Integer(cypherkey, ( (sum >> 11) & 3) ) ); sum -= delta; dword1 = dword1 - ( ( (dword2 << 4) ^ (dword2 >> 5) ) + dword2) ^ (sum + llList2Integer(cypherkey, (sum & 3) ) ); } cryptlist = [dword1,dword2]; return cryptlist; }
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 09:23
yes, we have only to wait that they reopen the grid! i hope it solve the problem!
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 10:07
Tested.
It doesn't work, and can't decrypt too. I continue to investigate...
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 11:33
From: Tobia Forcella Tested.
It doesn't work, and can't decrypt too. I continue to investigate... which keys did you use? I'm going to try and get PHP running on my local machine to allow me to play with this a bit more.
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
04-18-2007 11:58
From: Newgate Ludd which keys did you use? I'm going to try and get PHP running on my local machine to allow me to play with this a bit more. Whee! I always enjoy learning a new language, personally. I shied away from PHP for a long time cause I was exploring what I perceived to be "cleaner" languages, but I am going full-tilt with PHP right now on a medium-sized project and actually enjoying myself. I have the usual laundry list of gripes, but for the most part I am quite pleased with it. It fits my current hosting plan nicely too, which was a primary motivator 
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 12:05
From: RobbyRacoon Olmstead Whee! I always enjoy learning a new language, personally. I shied away from PHP for a long time cause I was exploring what I perceived to be "cleaner" languages, but I am going full-tilt with PHP right now on a medium-sized project and actually enjoying myself. I have the usual laundry list of gripes, but for the most part I am quite pleased with it. It fits my current hosting plan nicely too, which was a primary motivator  LOL, I tend to stick with what I know and only move to new languages as and when I have to. Normally at gun point. I'm not web orientated so for me its a bit of a pointless language to learn in that I cannot perceive a use for it in what I do on a day to day basis. Then again I remember saying near enough the same things about C, C++, Ada, Awk, ....
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
04-18-2007 12:21
From: Newgate Ludd LOL, I tend to stick with what I know and only move to new languages as and when I have to. Normally at gun point. I'm not web orientated so for me its a bit of a pointless language to learn in that I cannot perceive a use for it in what I do on a day to day basis. Then again I remember saying near enough the same things about C, C++, Ada, Awk, .... I am a geek that way, I guess But even what I do on a day-to-day basis is pretty variable over time... I've worked at Microsoft on several internal web apps, written IDE's and compilers (mostly DSL) for my own company, embedded programming for autonomous sumo robots (fun!), asset tracking and calibration management software for the US military, written a whole host of development tools and utilities as shareware, done web front-ends for mortgage and reconveyance companies, etc, etc. I like being a contractor, it keeps things from getting boring  Of course, it also is currently keeping me from looking into this problem as much as I'd like to. It sounds like a fun and interesting thing to solve, but I have to steal time just to check the forums, haha. .
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 15:24
From: someone which keys did you use? I'm going to try and get PHP running on my local machine to allow me to play with this a bit more. If it can't decrypt, i think that the problem is'n the keys  PS: I tested the php classes on 4 PC, linux and windows, with the same results; can someone try other ports of Xtea? (java, c++, ecc); we can compare with php and lsl results and see what is wrong!!!!
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-18-2007 15:51
From: Tobia Forcella If it can't decrypt, i think that the problem is'n the keys  PS: I tested the php classes on 4 PC, linux and windows, with the same results; can someone try other ports of Xtea? (java, c++, ecc); we can compare with php and lsl results and see what is wrong!!!! I agree, or a mismatch between the encrypt and decrypt routines I hashed up. I'm going to try terh routines out in C tomorrow and see where we get to.
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 16:06
I'm trying now the other LSL Xtea port in this post. string cryptato = xtea_encrypt_string(32, "test", "0123456789abcdef"  ; string decryptato = xtea_decrypt_string(32, cryptato, "0123456789abcdef"  ; It works (crypt and decript) but it give to me a csv as crypted string : 114333501, 1940443052 trying this i have strange chars: list lista = llCSV2List(cryptato); llOwnerSay(xtea_int_list_to_str(lista)); how to convert in HEX?
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
04-18-2007 19:45
Yeah, I'm pretty sure that the problem isn't the keys, rather that it's the LSL implementation. The LSL implementation works great when it's used as both the source and the destination, it just doesn't decrypt the data encrypted by php or C# implementations I've found.
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-18-2007 20:05
have you tested c# implementations? they give the same result as php?
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
04-18-2007 20:09
From: Tobia Forcella have you tested c# implementations? they give the same result as php? I believe they did... I will re-check that, as I cannot remember with certainty.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-19-2007 00:26
From: RobbyRacoon Olmstead Yeah, I'm pretty sure that the problem isn't the keys, rather that it's the LSL implementation. The LSL implementation works great when it's used as both the source and the destination, it just doesn't decrypt the data encrypted by php or C# implementations I've found. Well a first pass of being able to encrypt and decrypt your own messages is agood but unless we can interface to the external system its not useable in this application. From: Tobia Forcella It doesn't work, and can't decrypt too. I continue to investigate... Did you mean it doesnt encrypt itself and decrypt ok or just doesnt work at all?
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-19-2007 01:58
From: Tobia Forcella I'm trying now the other LSL Xtea port in this post. string cryptato = xtea_encrypt_string(32, "test", "0123456789abcdef"  ; string decryptato = xtea_decrypt_string(32, cryptato, "0123456789abcdef"  ; It works (crypt and decript) but it give to me a csv as crypted string : 114333501, 1940443052 trying this i have strange chars: list lista = llCSV2List(cryptato); llOwnerSay(xtea_int_list_to_str(lista)); how to convert in HEX? 114333501 = 0x06D0973D 1940443052 = 0x73A8CFAC i.e. 06D0973D73A8CFAC Which I dont think matches any of the PHP results? Using PEAR Xtea: 03e3fc60351a3fdd - test Using mcrypt: 6c302719dd265d3f - test����
|
Tobia Forcella
Registered User
Join date: 4 Mar 2007
Posts: 30
|
04-19-2007 05:21
From: someone Did you mean it doesnt encrypt itself and decrypt ok or just doesnt work at all? It crypt but can't decrypt, so i think it doesn't work  Nobody here that have an idea on how to solve? 
|