diff options
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerUtil.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp index a5218d422da..6764a46e7d6 100644 --- a/llvm/lib/Fuzzer/FuzzerUtil.cpp +++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp @@ -63,15 +63,19 @@ void PrintASCII(const Unit &U, const char *PrintAfter) { PrintASCII(U.data(), U.size(), PrintAfter); } -std::string Hash(const Unit &U) { - uint8_t Hash[kSHA1NumBytes]; - ComputeSHA1(U.data(), U.size(), Hash); +std::string Sha1ToString(uint8_t Sha1[kSHA1NumBytes]) { std::stringstream SS; for (int i = 0; i < kSHA1NumBytes; i++) - SS << std::hex << std::setfill('0') << std::setw(2) << (unsigned)Hash[i]; + SS << std::hex << std::setfill('0') << std::setw(2) << (unsigned)Sha1[i]; return SS.str(); } +std::string Hash(const Unit &U) { + uint8_t Hash[kSHA1NumBytes]; + ComputeSHA1(U.data(), U.size(), Hash); + return Sha1ToString(Hash); +} + static void AlarmHandler(int, siginfo_t *, void *) { Fuzzer::StaticAlarmCallback(); } |