开发者

Generating a MD5 Hash from a file

When A MD5 has开发者_JAVA技巧h from a file dose the hash generates for the File name ? .. or how unique is the MD5 hash from file to file ?


MD5 is long and good enough to prevent random collisions between two files.

But if you have an attacker that can control the files, he can easily create two files that have the same hash. This is because MD5 has collision vulnerabilities. Consider using another hash, such as SHA1. Git uses the SHA1-Hash of files to identify them.


Whether it will be generated based on file name, contents or both depends on how you implement it. MD5 hashes are quite unique - you can use them for identifying data in many scenarios (specifically when security is not an issue).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜