The RFC is very superficial on the implementation details. What is the injective function being used?


MD5 digest is produced by applying the MD5 algorithm to these items in the following order:

   1. the TCP pseudo-header (in the order: source IP address,
      destination IP address, zero-padded protocol number, and
      segment length)
   2. the TCP header, excluding options, and assuming a checksum of
   3. the TCP segment data (if any)
   4. an independently-specified key or password, known to both TCPs
      and presumably connection-specific

How are the above items concatenated? I wasn't able to find much information, could someone please point me in the right direction?

  • The items are concatenated by simple chaining.
    – Zac67
    Mar 3, 2020 at 11:53
  • If you are interested in implementation details, here is the starting point from the Linux Kernel: github.com/torvalds/linux/blob/… Nov 28, 2020 at 19:55
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Dec 17, 2020 at 16:12

1 Answer 1


I am guessing you are talking about authentication. To calculate the MD5 checksum, BGP needs to take some information as a base to calculate. If it would only use the password, it would be easy to reverse engineer given the hash and some rainbow tables or time with bruteforce. The information for calculating the hash needs to be present at both the sender and receiver side of a packet. This is given using the options you mentioned. Using these dynamically changing options in the MD5 calculation help to make it harder to reverse engineer the password.

So basically these options ensure that the base to calculate the MD5 hash are present at both sides, and that they are not static.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.