Saturday, May 05, 2007

A Short Tutorial in Counting Hex

Apparently the AACS doesn't want their keycode for playing DVDs to be published (like they have a right to prevent someone from publishing a hexadecimal number -- hmph).

Just for the sake of being cooperative, even though I think they're in the wrong, I'll refrain from publishing that number in this tutorial.

When counting in hexadecimal, think of an odometer from an older car, which has the numbers 0-9 painted on the "wheels" of the odometer. As each wheel turns, the number increments by one, from 0 to 1, then from 1 to 2, all the way up to when 9 rolls over to become 0 again. When that wheel rolls over to zero again, the wheel just to the left increments by one.

Hexadecimal works the same way, except that the numbers on the wheel don't stop at 9, but include A to F after the 9 before rolling back around to 0. Counting in hexadecimal works like this:

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
20
21

... and so on. When you get to really big numbers, it's sometimes easier to break them up with hyphens to make them easier to read. Like so:

09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-BA
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-BB
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-BC
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-BD
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-BE
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-BF
xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-C1
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-C2
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-C3
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-C4
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-C5
09-F9-11-02-9D-74-E3-5B-D8-41-56-C5-63-56-88-C6

Sorry I had to blank out that one number in my example above; as mentioned, the AACS doesn't want that number published.

I hope this little tutorial has been helpful.

5 comments:

evoljasen said...

Why is hexadecimal (six) not just numbers 0-5? And if it IS 0-9,A-F then why did you leave 18 & 19 out of your example.

Kent West said...

Oops; somebody can't count.

Correction made.

Thanks for pointing it out.

evoljasen said...

But I still wonder why hexadecimal isn't just 0-5. (?)

evoljasen said...

Hmm. I may have just figured it out: hex- is six and deci- is ten; hexadeci- could be sixteen.
[Man, I wish I would have taken Latin.]

Kent West said...

Wikipedia (http://en.wikipedia.org/wiki/Senary) says:

In mathematics, a senary numeral system is a base-6 numeral system. The name heximal is also valid for such a numeral system, but is deprecated to avoid confusion with the more often used hexadecimal number base, colloquially known as 'hex'.


Another resource suggested that hexadecimal breaks down into hex=6 and decimal = 10, so hexadecimal is 6 + 10 = 16.

And Base-32 is "hexatridecimal", which by the above logic would break down into 6 + (10*30) = 36. Hmm; doesn't make sense, does it?

No wonder I never did well at math, with "rules" like that.