Home > Archive > CCNP > November 2002 > Anybody have a good binary to hex formula ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Anybody have a good binary to hex formula ?
Justin2112

2002-10-28, 8:20 pm

Hey Cisco World gurus -

I am crankin' on CCIE on written now - and I was wondering if anyone had a good way to calculate binary to hex ? Cisco has a 'chart' but I think a formula would be cool.

Thanks,

Justin
freak

2002-10-28, 9:13 pm

check out www.mcsefreakpress.com/hex.htm for a free hex, bin and dec study guide. I hope it answers your question
kphua

2002-10-28, 9:17 pm

If you refer to any decent Computer Science book, it's all there. A Hex number is basically a 4-bit binary number ranging from
0000-1111 (0-15 in decimal).

Starting from the rightmost bit (the LSB), each bit represents the value of a power of 2. The rightmost bit (bit 0) is 2^0 (2 to the power of zero), or 1.

The second bit(bit 1) is 2^1 = 2
The third bit (bit 2) is 2^2 = 4
The fourth bit (bit 3) is 2^3 = 8.

So a formula to convert binary to hex is:
n = (b0 * 1) + (b1 * 2) + (b2 * 4) + (b3 * 8)

Of course, you will get a decimal value, but convert from decimal to hex is trivial.

Hope this helps.
The Reamer

2002-10-29, 7:01 am

The way I would handle this, and I am nowhere near an expert, would be to take the number in binary and separate the byte into niblets. Then it is easy to get the hex.

For example, 75 in binary is 01001011. Break this into niblets would give you 0100 and 1011. Convert each niblets into its hex value and you get the following:

0100 = 4
1011 = B

So 01001011 in binary is 4B in hex.

Another example:

2717 is 101010011101 in binary.
The niblets would be 1010 1001 1101.
So the hex would be A9D

HTH,

Reamer

P.S. Don't forget the leading zeros.
Justin2112

2002-10-29, 12:37 pm

Thanks everyone . . .

I totally appreciate your help and expertise. My your kindness come back to you 10X ... or a 6 figure job working on Cisco routers !!

Peace,

Justin
freak

2002-10-29, 12:40 pm

LOL That would be nice indeed!

You're very welcome, by the way...
darthfeces

2002-10-29, 1:15 pm

routing tcp/ip volume 1 by doyle
appendix "a"
Justin2112

2002-11-02, 9:28 am

Thanks Darth -

Jeff Doyle's book just arrived in my mail box a week ago; already a third into it - one of the better Cisco Press books for sure.

Thanks for the ref -

REACE,

Justin
darthfeces

2002-11-02, 12:07 pm

i'd go farther than that ....
i'd call tcp/ip volume 1 and caslow to be the absolute core bible's for the lab.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2009 examnotes.net