|
Hex
|
How It Works
|
|
|
Hex is short for Hexadecimal, which in turn means the representation of numbers in "base 16" as opposed to the decimal (base 10) system we are all familiar with. The ASCII code for the letter "A", for example, is 65 in base 10 and 41 in hex. (4x16+1=65) The reason you will often see ASCII codes expressed in hex format is that they all have values between 0 and 255 (decimal). In hex, users are disciplined about the use of leading zeros and all ASCII values are expressed using 2 characters. ASCII zero, for instance is decimal 0 and hex 00 ASCII 6 is decimal 6 hex 06 ASCII 255 is decimal 255, hex FF It is the ability of hex format to represent all ASCII values with just 2 characters that makes it popular and unambiguous. For instance, if we express ASCII characters in a stream of decimal digits such as "14213", you have no idea whether I mean 14,213 or 142,13, or even 1,42,1,3 etc. In fact, the only way I can make it clear is with those extra commas (which waste a character every time); whereas "8B0C" is unambiguous. The first two characters (8B) translate to decimal 142 and "OC" translates to decimal 13. |
||
|
|