here's my code.
Code:
char * Encrypt ( const char * string, const char * key )
{
//char * newString = const_cast<char*>(string);
std::string result = string;
for (int i=0; i<strlen(string); i++)
{
int pos = i;
while ( (pos+1) > strlen(key) )
pos -= strlen(key);
result[i] = string[i] ^ key[pos];
}
return const_cast<char*>(result.c_str());
}
int main()
{
char * lala = "Hi. This is a test.";
const char * key = "STEAM_0:0:4549308";
char * result = NULL;
result = Encrypt( lala, key );
printf("%s \n%s\n%s", lala, key, result);
//for (int i=0; i<strlen(result); i++)
// printf("%i", result[i]);
//printf("\n");
return 0;
}
It doesn't seem to be working... Any ideas?
It doesn't seem to do what its supposed to, I get almost all the same character as my answer.
What I want to do is 'encrypt' using the key, and loop the key so that it doesn't go out of range.