A hex code is 4 bits (2^4 = 16, so each digit in Hex has 16 possible values). Thus each byte is represented by 2 hex codes.
You can convert numbers between hex, binary, and hexidecimal really easy, but I forget how at the moment. I always just use the calculator that comes with windows. In "scientific" mode it can operate as a converter between decimal, hex, and binary.
it's the same calculation regardless of base ...
using 4 digits for example:
--4--3--2--1
v4 v3 v2 v1
in decimal (base 10)
v(1-4) can be 0 to base-1 [or 0 - 9]
and the resulting value is an addition of:
v1 x base^0 = v1 x 10^0 = v1 x 1
v2 x base^1 = v2 x 10^1 = v2 x 10
v3 x base^2 = v3 x 10^2 = v3 x 100
v4 x base^1 = v4 x 10^3 = v4 x 1000
etc ... how ever many digits you want to go.
this is how we all learned to count.. or should have. ;)
in hexidecimal (base 16):
--4--3--2--1
v4 v3 v2 v1
where v(1-4) can be 0 to F [0 - 15]
the value is an addition of:
v1 x base^0 = v1 x 16^0 = v1 x 1
v2 x base^1 = v2 x 16^1 = v2 x 16
v3 x base^2 = v3 x 16^2 = v3 x 256
v4 x base^1 = v4 x 16^3 = v4 x 4096
in binary (base 2):
where 8 bits are used to make up a byte
v(1-8) can be 0 or 1
--8--7--6--5--4--3--2--1
v8 v7 v6 v5 v4 v3 v2 v1
the value is an addition of:
v1 x base^0 = v1 x 2^0 = v1 x 1
v2 x base^1 = v2 x 2^1 = v2 x 2
v3 x base^2 = v3 x 2^2 = v3 x 4
v4 x base^3 = v4 x 2^3 = v4 x 8
v5 x base^4 = v5 x 2^4 = v5 x 16
v6 x base^5 = v6 x 2^5 = v6 x 32
v7 x base^6 = v7 x 2^6 = v7 x 64
v8 x base^7 = v8 x 2^7 = v8 x 128
Note:
while in binary ...
it takes 8 digits to represent 0-255 (00000000 - 11111111)
in hex ...
it takes only 2 digits to represent 0-255 [00 to FF]
it's no mistake we use binary and hex in computers ...
as 2^8 = 16^2 = 256 and can be used to represent 0-255 ...
so we only need two placeholders instead of 8.
well ...
got carried away there ...
you guyz probable know all this and more.
I learned how to do all this by hand back when the
only calculator we had was a pencil and sliderule ...
and we geeks of those daze wore them slung from
our belts in leather holsters like a six-shooter ...
and the only computer ... one's own brain. ;)
and I just happen to love numbers ...
they make more sense then most people. :lol:
~griz~