the word "output" comes out all wrong, as if it is encrypted, though it shouldn't... The second portion works just fine...
I know my code is messy, I thre it together in about 10 minutes to make sure it could be done.
#include <iostream>
int main()
{
int i = 0;
char x[13] = {"This is a te"};
char key[13] = {"kalsnhjdlkit"};
char output[13];
char decrypt[13];
for(i = 0; i < 13; i++)
{
output[i] = x[i]^key[i];
}
printf("output XORed: "); // <---- Problem is here
i = 0;
while(i < 13)
{
printf("%c", output[i]);
++i;
}
printf("\n");
for(i = 0; i < 13; i++)
{
decrypt[i] = output[i]^key[i];
}
printf("Un XORed: ");
i = 0;
while(i < 13)
{
printf("%c", decrypt[i]);
++i;
}
printf("\n");
return 0;
}

New Topic/Question
Reply


MultiQuote



|