简体   繁体   中英

Generating a MD5 Hash from a file

When A MD5 hash 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM