Hacking and Phreaking in the UK. Old school ethics, New school tech.

What is Hexadecimal?

Hexadecimal or “hex” is a numbering system based on binary, but is alot easier and quicker to work with. Hex is a base-16 system and uses the 16 values : 0 1 2 3 4 5 6 7 8 9 A B C D E and F. You will see why it is a base-15 system just now.

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 
Hexadecial 0 1 2 3 4 5 6 7 8 9 A B C D E F

Converting Binary to Hex

To work out the hexadecimal value of a given Binary value, you simply need to split each part of the byte or binary word into sets of 4 bits. Take the number 97 for instance:

97 = 01100001 in binary. We would then split this into groups of 4 bits, starting left - right, like so.

0110 0001

Each Hex value is 4 bits in length. Now remeber when i said that Hex is a Base-16 system? Well I say this because the highest decimal value a Hex value can have is 15. For example : 1111, which , going back to binary, is 8+4+2+1 = 15.
Looking at the table above we can see that 15 in Hex is represented by an “F”. For example :

97 = 0110 0001 in decimal or 6 and 1 (4+2 and 1). So as to not confuse a hexadecimal value with any other we put a “0x” in front of the actually hex value, like so : 0×61

To find the Hex value for a decimal value you woudl need to convert it to binary first:

31 = 00011111 in binary which would be 0×1F in hex as, 0001 = 1 and 1111 = F (15=F).

If you think you are comfortable with Hexadecimal, try some of the following questions.

Excercises

What is the hex value of the binary : 01011110
What is the hex value of the binary : 00011010
What is the hex value of the binary : 11010010

What is the binary value of the hex : 0xEF
What is the binary value of the hex : 0xA5
What is the binary value of the hex : 0×12

What is the decimal value of the hex : 0xFF
What is the decimal value of the hex : 0×51
What is the decimal value of the hex : 0×0E