[lld] r287727 - Use SHA1::hash and MD5::hash functions.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 16:52:28 PST 2016


Author: ruiu
Date: Tue Nov 22 18:52:28 2016
New Revision: 287727

URL: http://llvm.org/viewvc/llvm-project?rev=287727&view=rev
Log:
Use SHA1::hash and MD5::hash functions.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=287727&r1=287726&r2=287727&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Nov 22 18:52:28 2016
@@ -359,18 +359,12 @@ void BuildIdSection<ELFT>::writeBuildId(
     break;
   case BuildIdKind::Md5:
     computeHash(Buf, [](uint8_t *Dest, ArrayRef<uint8_t> Arr) {
-      MD5 Hash;
-      Hash.update(Arr);
-      MD5::MD5Result Res;
-      Hash.final(Res);
-      memcpy(Dest, Res, 16);
+      memcpy(Dest, MD5::hash(Arr).data(), 16);
     });
     break;
   case BuildIdKind::Sha1:
     computeHash(Buf, [](uint8_t *Dest, ArrayRef<uint8_t> Arr) {
-      SHA1 Hash;
-      Hash.update(Arr);
-      memcpy(Dest, Hash.final().data(), 20);
+      memcpy(Dest, SHA1::hash(Arr).data(), 20);
     });
     break;
   case BuildIdKind::Uuid:




More information about the llvm-commits mailing list