I have the following line of code:
contents[pos++] ^= key[shift++];
What does the ^= operator mean?
^=
This is an XOR assignment statement. Mostly:
x ^= y;
matches with:
x = x ^ y;
This means storing an XOR operation on contents[pos++] using key[shift++] and setting contents[pos++] equal to the result.
contents[pos++]
key[shift++]
Example:
contents[pos++] 00010101 key[shift++] 10010001 -------- 10000100
This is a bitwise XOR operator.
x ^= y
mostly
x = x ^ y
of course this is a bitwise operation
http://en.wikipedia.org/wiki/Bitwise_operation
This is a bitwise exclusive OR for two integers. http://bytes.com/topic/c/answers/726626-what-caret-qualifier