How to XOR two hexa numbers by hand fast I have an upcoming exam where I can use a simple Calculator. On some sample questions they ask us to XOR two values (for AES round key) and I know how to write it out by hand but is there any other faster way as the exam is timed of course.
If you are lucky, the definition of "simple calculator" may include all non-graphic calculators. In that case, you can use a Casio FX-115ES Plus, which includes hexadecimal and octal base modes, and has an XOR operator. It can operate on groups of octets up to 32 bits.

If you are not that lucky, the XOR table is your best friend. Depending on how many calculations you need to perform, it may very well be faster to create one on a scratch sheet during the exam. You may even be allowed to bring one with you.



I had a requirement for an XOR table to perform quick calculations on a printed code book for cryptographically strong communication over a public voice channel. It also had to be done quickly without the use of a computer or any electronic device, and had to fit on a small 4x6 sheet in the space under the ciphertext.

I came up with several methods to condense the table and still have it usable. If you are clever and resourceful, the knowledge of how to create the condensed versions can allow you to very quickly perform many XOR calculations. There is a recursive pattern to the hexadecimal XOR table which can be exploited, the table above is color coded to show this pattern, which extends down to the individual characters. Here are the condensed tables:



While the above table takes up less space, it has the same amount of characters, and thus takes about the same amount of time to create. A simple rule is required to select the correct characters.



The next level now takes both half the space of the previous, as well as half the characters. The rule is more complex, but a few minutes of practice makes it almost as fast to use as the full table. Even the rule can be simplified with XOR, the result will be correct if the XOR of the rule selections is 1.



The final level is once again half the space and half the characters (almost) as the previous, while requiring an additional rule to get the job done. If you remember the recursive structure and the basic layout of this table, you can recreate it in under a minute with a pen and paper.

Start with the inner column header, first nibble; 0 1 2 3 4 5 6 7 
Then add the 2nd nibble, which is the first nibble + 8; 8 9 A B C D E F 
The outer column header is the inner column header with the halves flipped 
The inner row header is the first half of the inner col header 
The outer row header is the first half of the outer col header 
Then you fill in the table with the recursive structure, built from the inner column header. 
Creating the double compressed table omits the outer headers but uses a full row header.

A single example on the triple table:

25 XOR B6 
2 X B = [2a] X [3b] (1 2 2) = 9 
Because 2 is the 1st nibble and B is the 2nd, we use the 2nd nibble of [19] 
5 X 6 = [5d] x [6e] (1 1 1) = 3 
Because 5 is the 1st nibble and 6 is the 1st, we use the 1st nibble of [3b] 
Therefore 25 XOR B6 = 93