Abstract
HighwayHash is a new pseudo-random function based on SIMD multiply and permute instructions for thorough and fast hashing. It is 5.2 times as fast as SipHash for 1 KiB inputs. An open-source implementation is available under a permissive license. We discuss design choices and provide statistical analysis, speed measurements and preliminary cryptanalysis. Assuming it withstands further analysis, strengthened variants may also substantially accelerate file checksums and stream ciphers.
Introduction
In modern computing, the demand for high-speed data processing often clashes with the necessity for secure hashing. Keyed hash functions are essential for protecting hash tables against Denial of Service (DoS) attacks, where an adversary crafts inputs to cause collisions. However, traditional secure hashes like SipHash, while robust, often become performance bottlenecks in high-throughput systems.
This paper introduces HighwayHash, a high-performance keyed hash function designed by Google Research to leverage modern CPU capabilities. By utilizing Single Instruction, Multiple Data (SIMD) instructions—specifically multiplication and permutation—HighwayHash achieves cryptographic-grade randomness at speeds previously reserved for insecure, non-cryptographic hashes.
The Hashing Landscape
The design of hash functions typically involves a trade-off between speed and security:
- Non-Cryptographic Hashes: Algorithms like CityHash or Murmur3 are exceptionally fast but vulnerable to collision attacks if the internal state is predictable.
- Cryptographic Hashes: Standards like SHA-3 provide high security but are computationally expensive, often requiring 2–3 CPU cycles per byte.
- Keyed Hashes: SipHash has served as the industry standard for security-conscious applications, balancing security with a performance of approximately 1.25 cycles per byte.
HighwayHash aims to bridge this gap, providing a keyed hash that maintains the robustness of SipHash while significantly increasing throughput.
Architectural Design
HighwayHash departs from the traditional Add-Rotate-XOR (ARX) design used in many hash functions. Instead, it focuses on two primary mechanisms:
SIMD Multiplication
The algorithm utilizes 32x32-bit SIMD multiplication to mix bits. While multiplication has higher latency than XOR (typically 5 cycles versus 1), its "mixing power" per instruction is substantially higher. This allows the algorithm to achieve thorough diffusion with fewer total rounds, resulting in a net performance gain.
Zipper Merge Permutation
To address the varying quality of bits in a multiplication result—where top and bottom bits are often more predictable—the authors developed the Zipper Merge. This novel permutation technique reshuffles the bytes of the 1024-bit internal state. It moves lower-quality bits to the middle and interleaves data between "lanes," ensuring that a change in any input bit rapidly "avalanches" across the entire state.
Hardware Optimization
HighwayHash is specifically tuned for the Intel AVX2 instruction set. It manages 16 SIMD registers to hide instruction latency by performing multiple operations in parallel, effectively saturating the CPU's execution units.
Experimental Evaluation
The authors evaluated HighwayHash using a strengthened version of the smhasher test suite. To detect subtle biases that might be missed by standard tests, the iteration count was increased from 300,000 to 30 million. Furthermore, the suite was updated to test every input size between 4 and 32 bytes and used a high-quality pcg64_k32 random number generator to ensure test inputs were unbiased.
Results
The performance benchmarks demonstrate significant improvements over existing standards:
- Throughput: For 1 KiB inputs, HighwayHash (AVX2) reaches 0.24 cycles per byte, making it 5.2x faster than SipHash (1.26 c/b).
- Small-Input Latency: Even for 8-byte inputs, HighwayHash outperforms SipHash (7.34 vs 8.13 cycles).
- Statistical Quality: In avalanche tests, HighwayHash’s bias was measured at approximately 0.07%, a result statistically indistinguishable from Intel’s hardware-based RDRAND generator.
Security Analysis and Limitations
Preliminary cryptanalysis indicates that HighwayHash is resistant to common differential, rotational, and length-extension attacks. However, the authors note that the "multiply-permute" family of hashes is less studied than ARX-based designs. Consequently, while HighwayHash is highly effective for hash tables and message authentication, the authors recommend further analysis before using it as a full cryptographically secure message digest (e.g., as a replacement for SHA-256).
Conclusion
HighwayHash represents a significant advancement in the design of keyed hash functions. By aligning the algorithm's structure with the strengths of modern SIMD hardware, it provides a high-security alternative to SipHash with a five-fold increase in performance. The implementation is open-source and available under the Apache 2 license.
Summary updated