I want to XOR the password (0x3d), byte by byte, with 0x42, then 0x51, then 0xF7, then 0x6F. this would give me 0xb6..... But, Is there a shortcut to this operation?
Tell me more
×
Mathematics Stack Exchange is a question and answer site for
people studying math at any level and professionals in related fields. It's 100% free, no registration required.
|
|
XOR is associative. Therefore, denoting XOR by ^, you can do
but also
which is
So you can XOR with 0x8B instead. In other words, "multiple xor" is equivalent to a single one. Associativity follows because XOR is associative on each bit. |
|||||
|
|
(p XOR q) = (¬p AND q) OR (p AND ¬q), if that was what you were asking. |
|||||||
|