Why is a 1 added after the message input and before adding padding zeros (if necessary) when using SHA256 or RIPEMD160? [duplicate]

In preparing an input for SHA256 or RIPEMD-160 a single bit (1) is appended to the message before adding any necessary zero padding and before adding the bitlength (64 bits) to form 1 or more 512 bit blocks. What is the purpose of adding the single bit (1)?

• Actually, that padding format goes back to (at least) MD4... – poncho Aug 22 '18 at 0:45
• @poncho I've been told that the single big is known as an injective and somehow prevents potential collisions due to padding, however, I can't figure out why the padding (if necessary) before the bitlength (given two different inputs) could create a collision which would make the injective necessary. – JohnGalt Aug 22 '18 at 14:33
• If there is a weakness due to a single bit, I would expect that weakness could be exploited to generate a collision/second preimage at an intermediate step (and hence produce a collision/second preimage at the final step, by leaving the rest of the message the same). I can see the point in including the message length (otherwise, if someone finds a way back to the IV, that leads to immediate collisions); I don't know the reason for also including the bit. – poncho Aug 22 '18 at 17:29

• This makes sense otherwise, but the padding also includes the length of the message, so being able to strip the $1|0^n$ part on its own is not required. The extra 1-bit seems unnecessary and in the worst case causes an extra block to be processed. – otus Sep 9 '18 at 7:32