---
name: "highwayhash"
section: "3"
platform: "linux"
package: "libhighwayhash-dev"
version: "0~git20200803.9490b14-4.1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/highwayhash"
---

# highwayhash(3)

fast strong 64-bit hash functions

## NAME

highwayhash - fast strong 64-bit hash functions

## SYNOPSIS

**#include \<highwayhash/c\_bindings.h\> /\* C \*/**

    uint64\_t SipHashC(const uint64\_t\* key, const char\* bytes, const uint64\_t size);

    uint64\_t SipHash13C(const uint64\_t\* key, const char\* bytes, const uint64\_t size);

    uint64\_t HighwayHash64(const HHKey key, const char\* bytes, const uint64\_t size);

**#include \<highwayhash/highwayhash.h\> /\* C++ \*/**

    using namespace highwayhash;

    void HighwayHashT(State\* HH\_RESTRICT state,\
                       const char\* HH\_RESTRICT bytes, const size\_t size,\
                       Result\* HH\_RESTRICT hash);

**#include \<highwayhash/sip\_hash.h\> /\* C++ \*/**

    using namespace highwayhash;

    HH\_U64 SipHash(const SipHashState::Key& key, const char\* bytes,const HH\_U64 size);

Link with *-lhighwayhash*

## DESCRIPTION

Hash functions are widely used, so it is desirable to increase their speed and security. This package provides two 'strong' (well-distributed and unpredictable) hash functions: a faster version of SipHash, and an even faster algorithm we call HighwayHash.

SipHash is a fast but 'cryptographically strong' pseudo-random function by Aumasson and Bernstein \[https://www.131002.net/siphash/siphash.pdf\].

HighwayHash is a new way of mixing inputs which may inspire new cryptographically strong hashes. Large inputs are processed at a rate of 0.24 cycles per byte, and latency remains low even for small inputs. HighwayHash is faster than SipHash for all input sizes, with 5 times higher throughput at 1 KiB. We discuss design choices and provide statistical analysis and preliminary cryptanalysis in https://arxiv.org/abs/1612.06257.

*Note, SipHash wants an uint64\_t\[2\] key while HighwayHash uint64\_t\[4\] .*

## EXAMPLES

64-bit SipHash for any CPU:

    \#include "highwayhash/sip\_hash.h"\
     using namespace highwayhash;\
     const HH\_U64 key2\[2\] HH\_ALIGNAS(16) = {1234, 5678};\
     char in\[8\] = {1};\
     return SipHash(key2, in, 8);

64, 128 or 256 bit HighwayHash for the CPU determined by compiler flags:

    \#include "highwayhash/highwayhash.h"\
     using namespace highwayhash;\
     const HHKey key HH\_ALIGNAS(32) = {1, 2, 3, 4};\
     char in\[8\] = {1};\
     HHResult64 result;  // or HHResult128 or HHResult256\
     HHStateT\<HH\_TARGET\> state(key);\
     HighwayHashT(&state, in, 8, &result);

64, 128 or 256 bit HighwayHash for the CPU on which we're currently running:

    \#include "highwayhash/highwayhash\_target.h"\
     \#include "highwayhash/instruction\_sets.h"\
     using namespace highwayhash;\
     const HHKey key HH\_ALIGNAS(32) = {1, 2, 3, 4};\
     char in\[8\] = {1};\
     HHResult64 result;  // or HHResult128 or HHResult256\
     InstructionSets::Run\<HighwayHash\>(key, in, 8, &result);

C-callable 64-bit HighwayHash for the CPU on which we're currently running:

    \#include "highwayhash/c\_bindings.h"\
     const uint64\_t key\[4\] = {1, 2, 3, 4};\
     char in\[8\] = {1};\
     return HighwayHash64(key, in, 8);

## SEE ALSO

/usr/include/highwayhash/c\_bindings.h (C)

/usr/include/highwayhash/highwayhash.h (C++)

## BUGS

https://github.com/google/highwayhash/issues

## AUTHOR

Upstream authors are Jan Wassenberg \<jan.wassenberg@gmail.com\> and Jyrki Alakuijala \<jyrki.alakuijala@gmail.com\>, updated 2017-02-07

This manpage was created by Adam Borowski \<kilobyte@angband.pl\>, and completed by Zhou Mo \<cdluminate@gmail.com\> according to upstream readme and header files.
