# How to convert UDP header to Decimal

I'm studying for my GSEC exam and one practice question has me stumped!  It should be easy but I'm just not grasping it.

The questions is What is the length in bytes of the UDP datagram in this UDP header?

04 1a 00 a1 00 55 db 51

I know 00 55 is the datagram.  And I know the answer is 85.  However, I have no idea why the answer is 85.

This should be a hex to decimal conversion correct?

Thank you!!
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Software and Hardware EngineerCommented:
if you look here you will see that the 5th and sixth byte are the length. this is 0x0055 which in decimal is 85

the double byte pairs are, in order:
0x041A (source port) = 1050
0x00A1 (dest port) = 161 (SNMP)
0x0055 (length) 85
oxDB51 (checksum) = 56145 (although this doesn't matter, and should be left in hex)
0
Author Commented:
Thank you, but how does it convert to 85 please?
0
Software and Hardware EngineerCommented:
it is as you assumed a hex to decimal conversion.
so...
0 x 4096 (2^12) = 0
0 x 256 (2^8) =0
5 x 16 (2^4) = 80
5 x 1 = 5

80+5 = 85 :)
0

Experts Exchange Solution brought to you by