I'm trying to reverse an XOR encryption. I have the encryption code:
// Walk the 16 nibbles in the 64 bit long long, selecting the corresponding key digit
// and XORing it into the result.
unsigned long long result = 0;
for( i=0; i<16; i++ )
{
int n = 4*(i % keyLen);
int k = (key & (0xF << n)) >> n;
result |= value&(0xF << 4*i) ^ (k<<4*i);
}
First line is fine.
Second and third is not. My 3 questions are:
- I guess I can just reverse the bitshift and it will work right?
- But how do I reverse a bitwise & ? So how does #2 is reversed?
- So if the answer is yes on #1, and I know how to do #2, then I can just do that and be able to decrypt yes?