From this point of view, depending on the amount of data that you are working with, SHA1 should succeed - if you are working with large amounts of data, a SHA-2 algorithm such as SHA-256 may be more appropriate since fear of collision in SHA1 growing due to a lack of its algorithm, but it is not extremely serious when working with a small amount of data.
It has been shown that MD5 is too vulnerable to collisions, as there were attacks on SSL certificates that used MD5 to create a fake SSL certificate, so I would stay away from it. Also, depending on your application, MD5 does not comply with FIPS 140, if that makes any difference to you.
SHA1 is ideal for MD5 because it is safer because MD5 is risky to use, and SHA1 has better performance in most common cases than SHA-2. SHA-2 algorithms are by no means slow, but they have an edge. However, SHA1 is a little riskier because you probably locked it in use - if collisions begin to be detected, it may be difficult for you to change, so it would be better to invest in the SHA-2 algorithm. The penalty for using SHA-256 over SHA-1 is very small, depending on how you use the SHA algorithm. SHA-2 algorithms produce a much larger output than SHA1, but in the interests of reduced chance of collision.
So which one is right? It depends on what you are looking for and on your use. Hope you can make a decision now.
source share