Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Need help implementing TEA or XXTEA aglorithm in lite-c #271129
06/11/09 12:28
06/11/09 12:28
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline OP
Member
Enduriel  Offline OP
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
Hello everyone, I am kinda stuck right now. I've tried the last couple of hours to implement this encryption algorithm in lite-c for encrypting STRING* declarations, but with not that much of a success.
So here I am in need of help from the big guy out there laugh

XXTEA C code:
http://en.wikipedia.org/wiki/XXTEA

TEA C code:
http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm


I've tried typecasting STRING*, char* when passing them into the functions but all I got was either crashes or weird returned characters after decryption. Can someone point out what I am doing wrong? Since the algorithm code is already there in the wiki, there isn't really that much of work left to be done, but I can't seem to be get it to work frown

Regards, Endu!

Re: Need help implementing TEA or XXTEA aglorithm in lite-c [Re: Enduriel] #271132
06/11/09 12:40
06/11/09 12:40
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
well, can we see your code? i mean, we cant help you much without seeing your code



Ubi bene, ibi Patria.
Re: Need help implementing TEA or XXTEA aglorithm in lite-c [Re: croman] #271133
06/11/09 12:46
06/11/09 12:46
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline OP
Member
Enduriel  Offline OP
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
It's pretty straight forward. The algorithm from wiki and this:

Code:
typedef unsigned int uint32_t;               //(for the TEA)

str_cpy(plaintext,"Text to be encrypted");
str_cpy(key,"7813498");

returned = encrypt ((uint32_t)plaintext, (uint32_t)key);
wait(-5);
beep();
str_cpy (str_show, (STRING*)returned);        //To show on screen


Then the same method for decrypting it back with the algorithm from the wiki. This example is the TEA, not XXTEA. I've also added return(v); at the end of the TEA function so "returned" catches it.

Last edited by Enduriel; 06/11/09 12:47.
Re: Need help implementing TEA or XXTEA aglorithm in lite-c [Re: Enduriel] #271141
06/11/09 13:52
06/11/09 13:52
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
i have used it for the lite-c filepacker. maybe you can learn something from the source.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1