What does "congruent to 448, modulo 512" mean for padding in MD5 hash function? What does "congruent to 448, modulo 512" mean within the MD5 hash specifications?

From the specification:


  The message is "padded" (extended) so that its length (in bits) is congruent to 448, modulo 512. That is, the message is extended so that it is just 64 bits shy of being a multiple of 512 bits long. Padding is always performed, even if the length of the message is already congruent to 448, modulo 512.
When we talk about a number $x$ being "congruent to 448 modulo 512", what we mean is that $x$ modulo 512 and 448 modulo 512 is the same number; since 448 is less than 512, this is equivalent to $x \bmod 512 = 448$

So, how the padding in MD5 works is "first you append a 1 bit (this part isn't mentioned in the above quote, but it's a necessary step), and then you keep on appending 0 bits until the total length of the message (mod 512) is exactly 448 (and then you append the 64 bit length of the unpadded message, in little endian order).

And, if you are only in hashing messages that are integral number of bytes (e.g. you don't care about the hash of a 123 bit message), then the equivalent procedure is "append an 0x80 byte, then then keep on appending 0x00 bytes until the total length of the message in bytes mod 64) is exactly 56 (and then you append the 8 byte length of the unpadded message).

Note that, in both cases, if the message after appending the 1 bit/0x80 byte is exactly 448/56, then you don't append any 0 bits/bytes.

Also, the SHA-1 and SHA-256 hash both use the same padding method (except that the byte length is in bigendian order)