llvm::getPointerAuthStableSipHash

Compute a stable non-zero 16-bit hash of the given string.

Synopsis

Declared in <llvm/Support/SipHash.h>

uint16_t
getPointerAuthStableSipHash(StringRef S);

Description

The exact algorithm is the little-endian interpretation of the non-doubled (i.e. 64-bit) result of applying a SipHash-2-4 using a specific seed value which can be found in the source. This 64-bit result is truncated to a non-zero 16-bit value.

We use a 16-bit discriminator because ARM64 can efficiently load a 16-bit immediate into the high bits of a register without disturbing the remainder of the value, which serves as a nice blend operation. 16 bits is also sufficiently compact to not inflate a loader relocation. We disallow zero to guarantee a different discriminator from the places in the ABI that use a constant zero.

Return Value

Non-zero 16-bit ptrauth discriminator derived from S.

Parameters

NameDescription
SString whose ptrauth discriminator is computed.