|
|
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
Enduriel
OP
Member
|
OP
Member
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  XXTEA C code: http://en.wikipedia.org/wiki/XXTEATEA C code: http://en.wikipedia.org/wiki/Tiny_Encryption_AlgorithmI'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  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
Serious User
|
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
Enduriel
OP
Member
|
OP
Member
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
|
It's pretty straight forward. The algorithm from wiki and this:
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.
|
|
|
|