//why do we add only the first 3 msb bits on nInputLen?
The
answer given to you on MSDN Forum is absolutely correct - "It seems that m_nCount[0] and m_nCount[1] together form a 64-bit counter of bits, split into two 32-bit halves."
The MD5 algorithm exists since 1992. The long was 32-bits.
And here you see the technique to handle number of bits greater than 2^32:
1. They create two 32-bits counters - m_nCount[0] and m_nCount[1];
2. When m_nCount[0] makes nInputLen << 3 it can result in overflow with highest bits lost;
3. Thus, the second counter m_nCount[1] accumulates these bits in
m_nCount[1] += (nInputLen >> 29);
4. Together these two 32-bits counters produce the resulting 64-bits value.
Imagine, for example, in decimal numbers m_nCount[0] - calculating tens and ones, and m_nCount[1] - calculating hundreds. Then, concatenated this two numbers will produce the resulting value.