• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 727
  • Last Modified:

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!!
  • 2
  • 2
1 Solution
Dave HoweSoftware 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)
cas_threeAuthor Commented:
Thank you, but how does it convert to 85 please?
Dave HoweSoftware and Hardware EngineerCommented:
it is as you assumed a hex to decimal conversion.
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 :)
cas_threeAuthor Commented:
Thank you so much!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

We Need Your Input!

WatchGuard is currently running a beta program for our new macOS Host Sensor for our Threat Detection and Response service. We're looking for more macOS users to help provide insight and feedback to help us make the product even better. Please sign up for our beta program today!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now