However, in Kademlia, we don't measure distance by decimal subtraction. To make it clear, decimal subtraction is just normal subtraction. The distance between 45 and 50 is 5. The distance between 53 and 63 is 10.
In Kademlia, measuring distance is done by XOR distance. The XOR distance between 3 and 6 is 5, not 3. Here's how to count it:
The binary version of 3 is 011. The binary version of 6 is 110. What I mean by binary version is the number in base 2. XOR means exclusive or. Using the XOR operation, 1 XOR 0 is 1, 1 XOR 1 is 0, 0 XOR 0 is 0, and 0 XOR 1 is 1. If two operands are same, the result is 0. If two operands are different, the result is 1.
011110---xor101
101 is the binary version of 5.
The XOR distance has a few useful ...