Get the latest tech news

XOR


[Simon Tatham, 2025-02-14] Recently I was called on to explain the ‘XOR’ operator to somebody who vaguely knew of its existence, but didn’t have a good intuition for what it was useful for and how it behaved. For me, this was one of those ‘future shock’ moments when you realise the world has moved on.

Earlier I discussed a number of mathematical laws obeyed by the one-bit version of XOR: it’s commutative, associative, has 0 as an identity, and every possible input is self-inverse in the sense that XORing it with itself gives 0. One option is for your keystream to be a huge amount of genuinely random data, as big as the total size of all messages you’ll ever need to send; this is known as a ‘one-time pad’, and is famously actually unbreakable – but also amazingly impractical for almost all purposes. But the winning strategy in Nim doesn’t depend on what base you write the pile sizes in, or even whether you wrote them down in place-value notation at all – so the appearance of bitwise XOR seems to be saying that binary is important to the underlying mathematics, whether humans have thought of it or not!

Get the Android app

Or read this on Hacker News

Read more on:

Photo of XOR

XOR

Related news:

News photo

The simple beauty of XOR floating point compression