To call a function in a smart contract, a transaction (or a message call depending on where it originates from) is sent to the contract address with a data field that has the encoded function signature and parameters. This encoding is done by taking the first 4 bytes of the keccak256 hash of the function signature and appending to it is the hash of each argument padded with 0s to 32 bytes width.
If, for example, I want to call a function
doSomething() that takes no arguments, the calldata would just be the first 4 bytes of the keccack256 hash of the signature:
keccak256('doSomething()') = 0x82692679
Now, since we only take the first 4 bytes isn't the possibility of overlap much higher now? How is this still maintaining cryptographic hash properties? I tried producing 2 function signatures with the same first 4 bytes (and I obviously couldn't) but my question is: how likely is it?