The Power of Hashing with Mersenne Primes
Thomas Dybdahl Ahle, Jakob Tejs B{\ae}k Knudsen, Mikkel Thorup

TL;DR
This paper explores advantages of using Mersenne primes in hash functions, introducing a 'Two for one' hashing technique that improves efficiency and maintains strong theoretical properties, demonstrated in Count Sketch for second-moment estimation.
Contribution
The paper introduces the 'Two for one' hashing method leveraging Mersenne primes, providing a new fast division/modulus algorithm, and applying these to improve hash-based algorithms.
Findings
Enhanced hash functions with Mersenne primes preserve strong theoretical properties.
The 'Two for one' hashing technique allows multiple hash functions from a single computation.
New fast branch-free code for division and modulus with Mersenne primes and Pseudo-Mersenne primes.
Abstract
The classic way of computing a -universal hash function is to use a random degree- polynomial over a prime field . For a fast computation of the polynomial, the prime is often chosen as a Mersenne prime . In this paper, we show that there are other nice advantages to using Mersenne primes. Our view is that the hash function's output is a -bit integer that is uniformly distributed in , except that (the all \texttt1s value in binary) is missing. Uniform bit strings have many nice properties, such as splitting into substrings which gives us two or more hash functions for the cost of one, while preserving strong theoretical qualities. We call this trick "Two for one" hashing, and we demonstrate it on 4-universal hashing in the classic Count Sketch algorithm for second-moment estimation. We also provide a new fast…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAlgorithms and Data Compression · Chaos-based Image/Signal Encryption · Coding theory and cryptography
