Joebeach,<br>
I got your e-mail. No problem. The bug in the above code is that the message would be trunciated if any character in the "OrgString" matched the "key". If you put an uppercase U in the OrgString, you'll see what happens. I've had some fun with this (Added way more security), so check out the code below:<br>
<br>
#include <stdio.h><br>
#include <string.h><br>
#include <stdlib.h><br>
<br>
int main()<br>
{<br>
<br>
int length, x;<br>
char OrgString[] = "Hello there, and how are you today?";<br>
char EncryptedStr[80];<br>
char DecryptedStr[80];<br>
char key = 0x55; /* The encryption/decryption key */<br>
<br>
printf( "Original string --->%s\n", OrgString );<br>
<br>
length = strlen( OrgString );<br>
/* In the loop below we encrypt the original string with the "key" seed*/<br>
srand(key);<br>
for ( x=0; x<length; x++)<br>
{<br>
EncryptedStr[x] = OrgString[x] ^ rand();<br>
}<br>
EncryptedStr[x] = 0;<br>
printf( "Encrypted string -->%s\n", EncryptedStr );<br>
<br>
/* In the loop below we decrypt the encrypted string with the "key" seed*/<br>
srand(key);<br>
for ( x=0; x<length; x++)<br>
{<br>
DecryptedStr[x] = EncryptedStr[x] ^ rand();<br>
}<br>
DecryptedStr[x] = 0;<br>
printf( "Decrypted string -->%s\n", DecryptedStr );<br>
<br>
return 0;<br>
}<br>
<p> <br><a href=mailto:Kim_Christensen@telus.net>Kim_Christensen@telus.net</a><br><a href=
Page</a><br>