What does ^= mean in C/C++?
It is the XOR assignment operator. Basically:
x ^= y;
is the same as:
x = x ^ y;
This means preform an XOR operation on contents[pos++]
using key[shift++]
and set contents[pos++]
equal to the result.
Example:
contents[pos++] 00010101
key[shift++] 10010001
--------
10000100