Understanding the length b used in MD5

I am trying to understand MD5 hash algorithm from the link http://www.ietf.org/rfc/rfc1321.txt

At first I was not able to understand padding of MD5. Then I asked a question in this link: To understand a fact related to padding in MD5

From this answer I can understand padding. Now I have faced another problem: to understand the second step of MD5.

I am trying to understand the second step from the same link: http://www.ietf.org/rfc/rfc1321.txt

But I have failed to understand a sentence and a phrase as before. Here is the phrase:

A 64-bit representation of b

what does 64-bit representation stand for?

Here is the next sentence:

In the unlikely event that b is greater than 2^64, then only the low-order 64 bits of b are used.

what does lower-order bits mean?

Can anyone explain the above phrase and sentence with better clarity?

-

2 Answers

what does 64-bit representation stand for?

It's the length (in bits) of the hashed message, expressed as a 64 bit binary value (in little endian order). If you hash a 1 character message, $b=8$ (as 1 byte == 8 bits); this would be represented as the 8 bytes 08 00 00 00 00 00 00 00 (the 08 is first, because in little-endian order, you place the least-significant part first)

what does lower-order bits mean?

The length of the the $b$ field within the padding is 8 bytes long; if you were to hash an extremely long message (one $2^{61}$ bytes or longer), it might be the case that $b$ wouldn't fit in an 8 byte field. In that case, what you place into the field is the lowest 8 bytes into the field; another way to express this is that you place the value $b \bmod 2^{64}$ into the padding field.

On the other hand, $2^{61}$ bytes is an enormous amount of data; it is approximately the amount of data that flows over the internet globally in a day. It is quite unlikely that you (or anyone else) will ever compute an MD5 hash on that much data; you can in practice ignore this sentence.

-

If your message is longer than $2^{64}$ bits, i.e. $b>2^{64}$, which is $2^{61}$ bytes, or 16,777,216 Terabytes(!), this is more than 16 million terabytes, you just take the least significant 64 bits of the number $b$.

-