summaryrefslogtreecommitdiff
path: root/gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp')
-rw-r--r--gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp b/gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp
index d2f8e811bbf..b42a04854cd 100644
--- a/gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp
+++ b/gnu/llvm/lib/Fuzzer/FuzzerSHA1.cpp
@@ -16,15 +16,12 @@
// For the same reason we do not want to depend on SHA1 from LLVM tree.
//===----------------------------------------------------------------------===//
-#include "FuzzerSHA1.h"
-#include "FuzzerDefs.h"
+#include "FuzzerInternal.h"
/* This code is public-domain - it is based on libcrypt
* placed in the public domain by Wei Dai and other contributors.
*/
-#include <iomanip>
-#include <sstream>
#include <stdint.h>
#include <string.h>
@@ -196,27 +193,10 @@ uint8_t* sha1_result(sha1nfo *s) {
} // namespace; Added for LibFuzzer
-namespace fuzzer {
-
// The rest is added for LibFuzzer
-void ComputeSHA1(const uint8_t *Data, size_t Len, uint8_t *Out) {
+void fuzzer::ComputeSHA1(const uint8_t *Data, size_t Len, uint8_t *Out) {
sha1nfo s;
sha1_init(&s);
sha1_write(&s, (const char*)Data, Len);
memcpy(Out, sha1_result(&s), HASH_LENGTH);
}
-
-std::string Sha1ToString(const uint8_t Sha1[kSHA1NumBytes]) {
- std::stringstream SS;
- for (int i = 0; i < kSHA1NumBytes; 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);
-}
-
-}