No, it doesn't have to be injective. In theory, the range can be any group. It's k bits in practice (with addition mod 2^k or xor as the group operator), but k need not have any relationship with `lg(|S|)`.
Again, the MWHC construction does not need to map the hashed keys to ranks, they can map to the values directly.