Convert HEX to Decimal value? w/ an example

2019-08-07 00:23发布

问题:

My professor has assured me this example is correct but I can not back into it. I need to convert the mac of my printer to decimal so I can find the decimal value.

In the example he gave me, I have tried this on several online converters and I can not replicate it. What am I missing here, I searched stack I see some examples but I can not reproduce this so this is no duplicate.

MAC = AA:BB:CC:00:11:22, converted to decimal would be 170.187.204.0.17.34

回答1:

A mac address has a size of 6 byte. This bytes are seperated by colons.

To convert the mac address to decimal you have to convert these single bytes. So hex AA would be 140 decimal, BB=187 and CC=204 and so on...



回答2:

A MAC address has six groups of two hexadecimal digits. In this case you can think of ':' as periods to make it easier. So if MAC = AA:BB:CC:00:11:22 = AA.BB.CC.00.11.22 you'll separately convert each of the six hexadecimal groups to decimal form.

When converting from hex to decimal, I like to use exponential notation so I know I'm getting the right answer. After some practice, you pick it up can can do the conversions on sight.

(2nd digit x 161) + (1st digit × 160)

So starting from the right of the address, going through AA.BB.CC.00.11.22hex group by group looks like:

a.b.c.d.e.f

Remember: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15

a. (10 x 161) + (10 × 160) = 170dec

b. (11 x 161) + (11 × 160) = 187dec

c. (12 x 161) + (12 × 160) = 204dec

d. (0 x 161) + (0 × 160) = 0dec

e. (1 x 161) + (1 × 160) = 17dec

f. (2 x 161) + (2 × 160) = 34dec

So AA:BB:CC:00:11:22 = 170.187.204.0.17.34



标签: decimal hex