Expand description
Packed GhashSq256b in two layouts: sliced (struct-of-arrays) and interleaved
(array-of-structs).
GhashSq256b is the degree-two extension a + b·Y of the GHASH field, with Y² = X·Y + X.
Both layouts reduce a batch multiply to three packed GHASH multiplies (Karatsuba over Y)
rather than a schoolbook product per element, and both defer the GHASH reductions and the
multiply-by-X — all GF(2)-linear — so an inner product reduces once at the end.
- The sliced packings (
SlicedGhashSq256b) store theaandbcoordinates of every lane in two separate packed GHASH registers viaSlicedPackedField;Muland the rest of thePackedFieldsurface come generically fromSlicedPackedField. - The interleaved packings (
PackedGhashSq1x256b/PackedGhashSq2x256b, i.e.PackedPrimitiveType<M256/M512, GhashSq256b>) store each scalar as one contiguous 256-bit value — the same layout as the scalar field. The width-one packing carries the field arithmetic (and the scalarGhashSq256bderives its own from it), while the width-two packing divides into two width-one lanes.
In both, the coordinate register is a PackedPrimitiveType, so the multiply-by-X in the
reduction is a bit shift over the register rather than a full field multiply.
The width-one packing’s widening multiply is architecture-specific — see GhashSqWideMul1x,
which selects between batching the Karatsuba diagonal into one 256-bit carry-less multiply and
keeping the three products separate to defer the multiply-by-X past a reduction.
Structs§
- Ghash
SqInvert InvertOrZerostrategy forPackedGhashSq1x256b.- Ghash
SqSquare Squarestrategy forPackedGhashSq1x256b.- Sliced
Ghash SqWide - The unreduced product of two GHASH² elements, as three separate GHASH products.
Type Aliases§
- Packed
Ghash Sq1x256b - Packed
Ghash Sq2x256b - Sliced
Ghash Sq1x256b - Packed
GhashSq256bholding one extension scalar (the degenerate width-one packing). - Sliced
Ghash Sq2x256b - Packed
GhashSq256bholding two extension scalars. - Sliced
Ghash Sq4x256b - Packed
GhashSq256bholding four extension scalars. - Sliced
Ghash Sq256b - A GHASH² packing whose two GHASH coordinates pack into
PackedPrimitiveType<U, Ghash128b>.