Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dr_panther), 1,275 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 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 | chip programmers | 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