Papers
Topics
Authors
Recent
Search
2000 character limit reached

decBRWHash: SIMD AXU Hash Family

Updated 6 July 2026
  • decBRWHash is an almost-XOR-universal hash family built on Bernstein–Rabin–Winograd polynomials that partitions messages into c substreams for SIMD processing.
  • It reorganizes message blocks using a decimation strategy and recombines them through a Horner-style polynomial, achieving up to 23% speed-up compared to Poly1305.
  • The hand-optimized AVX2 implementation leverages 5-limb arithmetic with delayed reductions to deliver efficient 4-way SIMD parallelism with negligible AXU overhead.

Searching arXiv for the primary paper and closely related BRWHash/polyHash references. decBRWHash is an almost-XOR-universal (AXU) hash family parameterised by a positive integer cc and built from Bernstein–Rabin–Winograd (BRW) polynomials over prime order fields. Its defining design choice is a decimation strategy that partitions message blocks into cc BRW substreams and then recombines them by a Horner-style polynomial in xdx^d. Choosing c>1c>1 yields a hash function that can be implemented using cc-way single instruction multiple data (SIMD) instructions. The reported implementations focus on $4\!-\decBRWHash$ in hand-optimised AVX2 assembly over the primes 212712^{127}-1 and 213052^{130}-5, with comparisons against polyHash and the widely deployed Poly1305; for 213052^{130}-5, the source reports that $4\!-\decBRWHash$ is faster than Poly1305 for messages of a few hundred bytes and reaches about cc0 speed-up for message lengths in the few megabytes range (Nath et al., 9 Jul 2025).

1. Algebraic basis in BRW polynomials

The construction rests on two canonical ways to assemble field elements cc1 into a polynomial: the usual Horner polynomial and the BRW polynomial. The Horner form is

cc2

whereas the BRW polynomial is defined recursively by (Nath et al., 9 Jul 2025)

cc3

The source attributes key algebraic properties of BRW polynomials to Bernstein, Sarkar, Nath–Sarkar, and Ghosh & Sarkar. Three properties are central. First, the map cc4, cc5, is injective. Second, for cc6,

cc7

with equality if and only if cc8 is a power of two. Third, evaluation at a fixed cc9 requires only

xdx^d0

In the implementation-oriented interpretation given in the source, the xdx^d1 ring multiplications are performed with delayed reductions and about xdx^d2 full reductions. This algebraic profile is the foundation for using BRW polynomials as a hashing primitive rather than the usual Horner chain.

2. Formal definition of xdx^d3

The family is instantiated over a prime xdx^d4 of the form xdx^d5, specifically xdx^d6 or xdx^d7 in the reported implementations. The bit-lengths xdx^d8, xdx^d9, and c>1c>10 of message blocks, key, and tag are chosen so that c>1c>11, c>1c>12, and c>1c>13. A binary message c>1c>14 of length c>1c>15 is split into c>1c>16-bit blocks c>1c>17 and padded as (Nath et al., 9 Jul 2025)

c>1c>18

where each c>1c>19 is an cc0-bit field element and cc1 is the length encoding.

With key cc2, the hash family is defined by

cc3

Its structure is based on cc4 decimated BRW streams. Let

cc5

pad cc6, and for cc7 define

cc8

These cc9 BRW outputs are then recombined using a Horner polynomial in $4\!-\decBRWHash$0. The parameter $4\!-\decBRWHash$1 is chosen as

$4\!-\decBRWHash$2

and

$4\!-\decBRWHash$3

Finally,

$4\!-\decBRWHash$4

A boundary case is explicit: when $4\!-\decBRWHash$5, $4\!-\decBRWHash$6 exactly. In that sense, decBRWHash is not a distinct algebraic family unrelated to BRWHash, but a parameterised extension that preserves the $4\!-\decBRWHash$7 instance.

3. Decimation and vectorised evaluation

The source describes vectorisation at two levels: the outer $4\!-\decBRWHash$8-way recombination and the inner BRW evaluation. For polyHash, the $4\!-\decBRWHash$9-way Horner step is described as standard: one groups blocks by residue modulo 212712^{127}-10, forms 212712^{127}-11 parallel Horner chains over 212712^{127}-12, and finally collapses them. For decBRWHash, SIMD evaluation of four independent BRW polynomials over 212712^{127}-13 is obtained by running the usual BRW recursion simultaneously on 4-tuples of blocks (Nath et al., 9 Jul 2025).

The AVX2-oriented representation uses four simultaneous field elements in 212712^{127}-14-bit registers, with limbs in base 212712^{127}-15. In the high-level algorithm, one first precomputes

212712^{127}-16

via 4-way SIMD squarings. The main BRW evaluation then proceeds with a stack-based recursion in which every scalar variable is replaced by a SIMD vector of length four. Each ring multiplication and reduction becomes a 4-way AVX2 field operation.

A key implementation detail is the use of unreducedBRW_t for fixed small 212712^{127}-17, described as straight-line code evaluating a BRW of size 212712^{127}-18 with delayed reductions. The stack discipline uses count-trailing-zeros(i) and pop-combine steps before multiplying by a factor of the form 212712^{127}-19. This organisation makes the BRW recursion compatible with wide-lane SIMD execution without changing the underlying polynomial definition.

This suggests that decimation is not merely a data-layout device. It reorganises the message so that independent BRW instances align naturally with SIMD lanes, while the recombination polynomial 213052^{130}-50 restores a single hash value.

4. Hand-optimised AVX2 realisation

For 213052^{130}-51, the reported implementation uses a base-213052^{130}-52 5-limb representation,

213052^{130}-53

and packs four field elements 213052^{130}-54 into five AVX2 registers 213052^{130}-55, where 213052^{130}-56 holds the 213052^{130}-57-th limb of each of the four elements in its four 64-bit words (Nath et al., 9 Jul 2025).

The 4-way multiplication strategy forms all cross-products 213052^{130}-58 using 213052^{130}-59 vpmuludq instructions and accumulates them with vpaddq. The source notes that multiplications by 213052^{130}-50 can be replaced by shifting plus addition if one side is pre-scaled. The unreduced result fits in 213052^{130}-51 bits per limb.

Delayed reduction is an explicit optimisation. Up to 213052^{130}-52 additions of unreduced products are accumulated before a full carry-chain reduction. Full reduction uses a 6-step chain of limb-by-limb carries and multiplies by 213052^{130}-53, exploiting 213052^{130}-54, and is implemented with a mix of vpand, vpsrlq, and vpsllq. The source also emphasises shuffle and register scheduling: 213052^{130}-55, 213052^{130}-56, and intermediate stack vectors are assigned to YMM registers so that no spills occur and dependency chains are broken, thereby recovering near-peak throughput for vpmuludq with latency 213052^{130}-57 and throughput 213052^{130}-58 per cycle, and for vpaddq with latency 213052^{130}-59.

A further optimisation is the key-scaling trick. Whenever one operand of a multiplication is fixed, such as $4\!-\decBRWHash$0 or precomputed 5-scaled limbs, the five scaled limbs $4\!-\decBRWHash$1 are precomputed once so that each BRW step avoids “$4\!-\decBRWHash$2” multiplies. For $4\!-\decBRWHash$3, the same 5-limb AVX2 strategy is used, replacing $4\!-\decBRWHash$4 by $4\!-\decBRWHash$5 in reduction because $4\!-\decBRWHash$6. The authors also tried a 4-limb 32-bit representation for $4\!-\decBRWHash$7, but report that the extra unpack/add logic made it slower than the 5-limb code on current AVX2.

5. Empirical performance profile

The reported measurements were obtained on a single core of an Intel i7-1185G7 at $4\!-\decBRWHash$8 GHz, running Ubuntu 20.04, compiled with gcc 9.4 and flags -O3 -march=native, with cycle counts measured by RDPMC. The comparisons include Poly1305, an AVX2 implementation of $4\!-\decBRWHash$9 with delayed-reduction parameter cc00, AVX2-cc01 with BRW parameter cc02, and a reference 64-bit “maax” code for cc03 and cc04 (Nath et al., 9 Jul 2025).

Representative cycle-per-byte results for key-powers computed on the fly are as follows.

Message length Poly1305 / 4-decBRWHash Speed-up
256 B 0.94 / 0.82 cc05 (15%)
1 KB 0.70 / 0.55 cc06 (27%)
4 KB 0.61 / 0.45 cc07 (36%)
16 KB 0.43 / 0.34 cc08 (26%)
1 MB 0.430 / 0.350 cc09 (23%)

The source also states that, for cc10, compared to the famous Poly1305 hash function, cc11 is faster for messages a few hundred bytes long, achieves a speed-up of about cc12 for message lengths in a few kilobytes range, and improves to about cc13 for message lengths in a few megabytes range. More fine-grained tables for lengths cc14 blocks of cc15 bytes each, cc16 blocks, and cc17 blocks are reported in Tables 5–8 of the source. Across those experiments, cc18 and cc19 gave the best AVX2 performance. The same evaluation reports that beyond about cc20 bytes AVX2-cc21 outperforms the 64-bit maax code, and beyond about cc22 KB AVX2-cc23 outperforms its maax counterpart.

6. AXU security and the cc24 trade-off

The security analysis uses a polynomial-degree argument. For any two distinct messages cc25 of cc26 blocks, the map

cc27

is a nonzero polynomial of degree

cc28

After reduction modulo cc29 and then modulo cc30, the failure chance is multiplied by cc31, yielding the bound (Nath et al., 9 Jul 2025)

cc32

Hence cc33 is cc34-AXU with

cc35

The case cc36 recovers the bound for standard cc37. For cc38, the degree and hence the bound grow by at most cc39, which the source characterises as a negligible overhead for small cc40. At the same time, cc41 determines the SIMD width: doubling cc42 doubles the parallelism but adds only cc43 to the security bound and to the key storage, quantified in the source as approximately cc44 bytes.

In practical terms, the reported implementation identifies cc45 as a sweet spot on AVX2. This reflects the central design trade-off of decBRWHash: increasing cc46 improves SIMD exposure while only mildly perturbing the AXU bound for small cc47. The source therefore presents cc48 as a drop-in AXU hash suitable for high-throughput SIMD-accelerated authentication and AEAD constructions.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to decBRWHash.