As of 2011, which hash algorithm is most suitable for message digest?

I donโ€™t agree a bit with the answer when I say this to Google, because these algos are constantly being improved, and new exploits are found, and all new problems are constantly appearing ... a lot of tips on what to use algo is just old or keeps ideas with an older time when they were in a better way.

I want to be very clear here: I am not talking about passwords. I'm talking about message digests, not cryptographic hashes.

I could continue to use md5 as my first message for a message digest (this is correct in the title), but then I remembered that there were more collisions than more modern algas. But then, what makes these new algons more suitable for digesting a file message or short string?

So my question is what should be used in a modern message digest?

+4
source share
2 answers

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.

+2
source

If in doubt, use SHA-256 . Other SHA-2 features are great too; however, SHA-384 and SHA-512 may suffer from slight performance degradation on small (only 32-bit) platforms. This may be relevant for some specific applications.

For non-security-related uses (for example, the first pass of indexing in a hash table or detecting random, non-malicious data changes - the kind of work where you could use CRC ), consider MD4 , the predecessor of MD5. MD4 is even more broken than MD5, but also easier to implement (with shorter code) and faster (in fact, it was measured faster than CRC32 on some ARM platforms).

+2
source

Source: https://habr.com/ru/post/1344118/


All Articles