LLVM: lib/Support/SipHash.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
15#include "siphash/SipHash.h"
21#include
22
23using namespace llvm;
25
26#define DEBUG_TYPE "llvm-siphash"
27
30 siphash<2, 4>(In.data(), In.size(), K, Out);
31}
32
35 siphash<2, 4>(In.data(), In.size(), K, Out);
36}
37
38
40 static const uint8_t K[16] = {0xb5, 0xd4, 0xc9, 0xeb, 0x79, 0x10, 0x4a, 0x79,
41 0x6f, 0xec, 0x8b, 0x1b, 0x42, 0x87, 0x81, 0xd4};
42
46}
47
48
51
52
53 uint16_t Discriminator = (RawHash % 0xFFFF) + 1;
55 dbgs() << "ptrauth stable hash discriminator: " << utostr(Discriminator)
56 << " (0x"
57 << utohexstr(Discriminator, false, 4)
58 << ")"
59 << " of: " << Str << "\n");
60 return Discriminator;
61}
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
uint64_t read64le(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void getSipHash_2_4_64(ArrayRef< uint8_t > In, const uint8_t(&K)[16], uint8_t(&Out)[8])
Computes a SipHash-2-4 64-bit result.
Definition SipHash.cpp:28
ArrayRef< CharT > arrayRefFromStringRef(StringRef Input)
Construct a string ref from an array ref of unsigned chars.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
std::string utostr(uint64_t X, bool isNeg=false)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI uint64_t getStableSipHash(StringRef Str)
Compute a stable 64-bit hash of the given string.
Definition SipHash.cpp:39
LLVM_ABI uint16_t getPointerAuthStableSipHash(StringRef S)
Compute a stable non-zero 16-bit hash of the given string.
Definition SipHash.cpp:49
LLVM_ABI void getSipHash_2_4_128(ArrayRef< uint8_t > In, const uint8_t(&K)[16], uint8_t(&Out)[16])
Computes a SipHash-2-4 128-bit result.
Definition SipHash.cpp:33