f2568() — A variable Length Tabulation Hash Function
June 1, 2025
f2568() is a variable length tabulation hashing function which returns a 64 bit hash result of input data up to a size of 256 bytes. It's fast (requiring as many XOR operations as the data length in bytes), easy to understand and very strong at the same time.
f2568resume() allows to resume computation and to chain processing to generate a 64 bit hash of arbitrary length data divided in blocks of 256 bytes.
f2568() is publicly available under the BSD-3-Clause License.
Being a tabulation hash function, it’s not 4-independent, which can safely be ignored for the intended purposes (rendezvous hashing and packet processing).
The Implementation
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "f2568.h"
static uint64_t material[256 * 256];
uint64_t f2568(uint8_t* data, uint16_t len) {
int i;
uint64_t result;
result = 0xdc6cd513e996ae54;
for (i = 0; (i < 256) && (i < len); i++) {
result ^= *(material + i * 256 + data[i]);
}
return (result);
}
uint64_t f2568resume(uint8_t* data, uint16_t len, uint16_t offset, uint64_t previous) {
int i;
uint64_t result;
result = previous;
for (i = 0; (i + offset < 256) && (i < len); i++) {
result ^= *(material + (i + offset) * 256 + data[i]);
}
return (result);
}
static uint64_t material[256 * 256] = {
0xa9a5be624fabaa36, 0x4244b57f4c97d512, 0x0b2ce509c4827510, 0x8eb519ed8e23e207,
0x9e8ff36bd45a7fb2, 0xcb1036c7ad451936, 0x10d22673f56a3925, 0x69f1e6968a65fb61,
// true random data omitted
0x042455208e226dce, 0x5ba3a465aa881c02, 0xf9f052d441284117, 0xa557c4212ec4c08a,
0xa76d05d9e84c144c, 0x491e43cd77134161, 0xe13f55a5ac39d0ec, 0x5d6d37d6c2d333f5
};The Random Material
The random material is “true random” as it has been retrieved from the Quantis QRNG device, a physical random number generator exploiting an elementary quantum optics process.
To cover the possible input space of 256 bytes the required ramdom material size becomes 256 * 256 * sizeof(uint64_t) bytes (256KB). This size leads to increased latency due to memory cache misses, detailed performance benchmarks and comparisons are not yet ready.
Get Thomas G. Obermair’s stories in your inbox
Join Medium for free to get updates from this writer.
There are two functions operating on the same 256KB true random material as follows:
f2568()
- The implementation is straightforward and simple, note the fixed random initialisation value
result = 0xdc6cd513e996ae54;which is thef2568()result of data with length zero.
f2568resume()
f2568resume()allows to resume computation with additional data which is non consecutively located at another place.- Also, it allows to chain multiple
f2568resume()calls to obtain a strong 64 bit hash of arbitrary larger data (dividing it into 256 byte blocks and setting theoffsetto 0 on consecutive calls).
Test Vectors
f2568("", 0) 0xdc6cd513e996ae54
f2568("a", 1) 0x733057f5184fd8e8
f2568("ab", 2) 0x7e7a27a682632a2c
f2568("abc", 3) 0x033ba573649a3044
f2568("abcd", 4) 0xb3f66d62bcf674a4
f2568resume("cd", 2, 2, 0x7e7a27a682632a2c) 0xb3f66d62bcf674a4
f2568("abcde", 5) 0xa6141edba1c60acd
f2568("abcdef", 6) 0x430e40daa722a64b
f2568("abcdefg", 7) 0x3111e6b33be5be6c
f2568("abcdefgh", 8) 0x302ce90427347152
f2568resume("efgh", 4, 4, 0xb3f66d62bcf674a4) 0x302ce90427347152Resources
Originally published at https://blog.inlab.net on June 1, 2025.






