Hexadecimal Notation
Ninety-nine percent of the data you see in the registry is hexadecimal. Computers use hexadecimal notation instead of decimal for a good reason, which you\'ll learn in a bit. You must learn how to read and convert hexadecimal numbers to use the registry as an effective tool. And that\'s the point of this section.


Binary and decimal notations don\'t get along well. You learned decimal notation as a child. In this notation, 734 is 7 x 102 + 3 x 101 + 4 x 100, which is 7 x 100 + 3 x 10 + 4 x 1. Easy enough, right? The digits are 0 through 9, and because you multiply each digit right to left by increasing powers of 10 (100, 101, 102, and so on), this notation is called base 10. The problem is that decimal notation doesn\'t translate well into the computer\'s system of ones and zeros. Binary notation does. In this notation, 1011 is 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 or 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1 or 11. The digits are 0 and 1, and because you multiply each digit right to left by increasing powers of 2 (20, 21, 22, and so on), this notation is called base 2. Converting a binary number to a decimal number is a lot of work, and binary numbers are too cumbersome for people to read and write.


That brings us to hexadecimal notation. Hexadecimal notation is base 16, and because you can evenly divide 16 by 2, converting between binary and hexadecimal is straightforward. The digits are 0 through 9 and A through F. Table 1-2 shows the decimal equivalent of each digit. In hexadecimal, A09C is 10 x 163 + 0 x 162 + 9 x 161 + 12 x 160 or 10 x 4096 + 0 x 256 + 9 x 16 + 12 x 1, or 41,116 in decimal notation. As with the other examples, you multiply each hexadecimal digit right to left by increasing powers of 16 (160, 161, 162, and so on).


Table 1-2: Hexadecimal Digits


Binary


Hexadecimal


Decimal


0000


0


0


0001


1


1


0010


2


2


0011


3


3


0100


4


4


0101


5


5


0110


6


6


0111


7


7


1000


8


8


1001


9


9


1010


A


10


1011


B


11


1100


C


12


1101


D


13


1110


E


14


1111


F


15


Converting between binary and hexadecimal notations might be straightforward but it is time consuming, so I\'m offering you a trick. When converting from binary to hexadecimal, use Table 1-2 to look up each group of four digits from left to right, and jot down its hexadecimal equivalent. For example, to convert 01101010 to hexadecimal, look up 0110 to get 6, and then look up 1010 to get A, so that you end up with the hexadecimal number 6A. If the number of digits in the binary number isn\'t evenly divisible by 4, just pad the left side with zeros. To convert hexadecimal numbers to binary, use Table 1-2 to look up each hexadecimal digit from left to right, and jot down its binary equivalent. For example, to convert 1F from hexadecimal to binary, look up 1 to get 0001, look up F to get 1111, and string them together to get 00011111.