Introduce StringRef final() and StringRef result().
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Sorry I missed this before -- I have a few suggestions below to align this better with SHA1 and SHA256.
llvm/include/llvm/Support/MD5.h | ||
---|---|---|
81–83 | I'm not seeing finalWords() in the other hashers. I suggest not adding it. | |
85 | The other hashers return a StringRef. MD5 should align with that, and also return the raw bytes as they do (instead of a hex string). Looking at SHA1 and SHA256, they have two methods, result() and final(), the former of which can be called at any time. Here is the implementation of result(): StringRef SHA1::result() { auto StateToRestore = InternalState; auto Hash = final(); // Restore the state InternalState = StateToRestore; // Return pointer to hash (20 characters) return Hash; } I think if we're adding one we should add both, for consistency.
| |
llvm/lib/Support/MD5.cpp | ||
276 | The other hashers do not return a digest, but the raw bytes. MD5 should align with that. | |
llvm/unittests/Support/MD5Test.cpp | ||
77 | I think this should avoid a magic number, and just confirm that the final() return is equal to MD5Result::bytes when calling final(MD5Result&). |
I'm not seeing finalWords() in the other hashers. I suggest not adding it.