[PATCH] D31105: [Support] Add a function to MD5 a file's contents.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 16:11:14 PDT 2017


zturner added a comment.

In https://reviews.llvm.org/D31105#705792, @mehdi_amini wrote:

> How does it compare to the SHA1 API? Are these in sync? (If not any good reason they're not?)


It's pretty similar.  The main difference is that SHA1 only gives you a sequence of bytes, and there is no option to return the result any other way without manual effort on the part of the user.  I don't know if there is any good reason for this.  It seems to be fairly common practice for consumers of MD5 checksums to truncate the hash and only use the first 8 bytes or the last 8 bytes.  This seems much less common with SHA1 (as in, I don't know of any clients that do this, and I don't know if this affects the security of the hash in any way either).

If we can decide on a reasonable interface that allows both to be consistent, I'm happy to try to implement it (but hopefully orthogonally to this patch), keeping in mind that I'm not a hash expert, so I would not be the person to make any functional changes, but API changes are OK.


https://reviews.llvm.org/D31105





More information about the llvm-commits mailing list