I want to xor string with prepared key before :
Code:
unsigned char key[8];
char *text;
text = "testtesttesttest";
srand ( time(NULL) );
int lowest=0, highest=255;
int range=(highest-lowest)+1;
for(int index=0; index<8; index++){
key[index] = lowest+int(range*rand()/(RAND_MAX + 1.0));
}
for(int a=0; text[a] != NULL; a++)
{
text[a] ^= key[a%8];
}
I was programming in delphi before and i had byte type which is unsigned char here as i read. Conversion was pretty easy but don't know how to do that in C++.