Which is better in the comparison of MD5 vs SHA1?
It is well known that SHA1 is recommended more than MD5 for hashing since MD5 is practically broken as a lot of collisions have been found. With the birthday attack, it is possible to get a collision in MD5 with 264 complexity and with 280 complexity in SHA1
It is known that there are algorithms that are able to crack both of these in far less time than it takes for a birthday attack.
Is MD5 considered insecure only for this reason that it is easy to produce collisions? Because looking at both, producing collisions in SHA1 is not that difficult either. So what makes SHA1 better?
No. It's not just the length of the output. In MD5 vs SHA1, there are significant differences in their level of security against cryptanalytic attacks. There are devastating collision attacks on MD5. (The Wikipedia article on MD5 has some details.) These attacks mean that MD5 provides essentially no security against collisions: it is easy to find collisions in MD5. In contrast, SHA1 appears to be much more secure. While there are some known attacks on SHA1, they are much less serious than the attacks on MD5. (The Wikipedia article on SHA1 has an overview.) For this reason, SHA1 is a much better choice than MD5 in many settings. These days, instead of using MD5 or SHA1, you're probably even better off to use one of the more modern hash functions, like SHA256. Those have no known attacks of any practical relevance. But certainly don't use MD5 in any setting where collision-resistance is needed, as that aspect of MD5 is completely broken.