xref: /freebsd/contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerSHA1.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
1 //===- FuzzerSHA1.h - Internal header for the SHA1 utils --------*- C++ -* ===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 // SHA1 utils.
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef LLVM_FUZZER_SHA1_H
12 #define LLVM_FUZZER_SHA1_H
13 
14 #include "FuzzerDefs.h"
15 #include <cstddef>
16 #include <stdint.h>
17 
18 namespace fuzzer {
19 
20 // Private copy of SHA1 implementation.
21 static const int kSHA1NumBytes = 20;
22 
23 // Computes SHA1 hash of 'Len' bytes in 'Data', writes kSHA1NumBytes to 'Out'.
24 void ComputeSHA1(const uint8_t *Data, size_t Len, uint8_t *Out);
25 
26 std::string Sha1ToString(const uint8_t Sha1[kSHA1NumBytes]);
27 
28 std::string Hash(const Unit &U);
29 
30 }  // namespace fuzzer
31 
32 #endif  // LLVM_FUZZER_SHA1_H
33