arXiv:2610.41565cs.CROct 2026

Manuscript Offprint

arXiv:2610.41565

Poly Versus Polyval

Kaushik Nath, Palash Sarkar

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We revisit the basic construction of polynomial evaluation based hash function, which we call Poly, over binary extension fields over GF(2n)GF(2^n), where n=64kn = 64k and k≥2k \geq 2. Unlike GHASH, the NIST standard polynomial evaluation based hash function for n=128n = 128, Poly does not perform the unnecessary bit reversals of each nn-bit block, and consequently is faster than GHASH. Further, Poly differs from Polyval, – a faster alternative to GHASH, – in that Poly performs usual reduction, while Polyval performs Montgomery reduction. We identify suitable choices of the field representing irreducible polynomials which makes usual and Montgomery reductions efficient. We provide detailed algorithms, and associated proofs of correctness for both kinds of reductions. Based on the algorithms, we report carefully optimised assembly implementation of both Poly and Polyval for n=128,256n = 128, 256 and 512. Our theoretical analysis and experimental timing results show that for n=128n = 128, Polyval is faster than Poly, while for n=256n = 256 and 512 (as well as for higher values of nn), Poly is faster than Polyval. The cases n=128n = 128 and 256 are of current relevance due to the ongoing NIST process for developing cryptographic accordions.

Keywords: almost XOR universal, polynomial hashing, Poly, Polyval, GHASH, cryptographic accordions, assembly implementation.

1 Introduction

One of the widely used methods of symmetric key encryption is the Galois Counter Mode (GCM) [14] which is a standard of the National Institute of Standards and Technology (NIST) of the USA [8]. GCM uses two basic components, namely the Advanced Encryption Standard (AES) [18], and the almost XOR universal (AXU) hash function GHASH [14].

A hash function maps messages, – which are binary strings of some maximum length, – to digests. The general structure of a polynomial evaluation based AXU hash function is the following. Given a message, it is uniquely mapped to a sequence of elements of an underlying field. This sequence defines the coefficients of a polynomial over the field. The resulting polynomial is evaluated at a secret field element, – called the hash key, – to obtain the digest.

The hash function GHASH is defined over the Galois field GF(2128)GF(2^{128}). A basic problem of GHASH arises in the manner in which messages are converted to polynomials. The message is formatted into 128-bit blocks, and then each 128-bit block is reversed. The resulting sequence of 128-bit blocks is the sequence of coefficients of the polynomial corresponding to the message. The bit reversals of the blocks are unnecessary in the sense that these reversals are not required for the AXU property to hold.

The actual computation of the digest in GHASH is essentially a polynomial evaluation which is done using a Horner style computation. Apart from the bit reversals of the blocks, each iteration of the Horner computation requires a multiplication over GF(2128)GF(2^{128}). Such a field multiplication consists of a multiplication of two polynomials followed by a usual reduction modulo the irreducible polynomial which defines GF(2128)GF(2^{128}) over GF(2)GF(2). The bit reversals of the blocks in GHASH contribute to an unnecessary computational overhead.

The AXU hash function Polyval was proposed in [12] as a faster alternative to GHASH. Polyval also defines a unique sequence of field elements from the message and performs a Horner style computation. Each iteration performs a polynomial multiplication followed by a Montgomery reduction [15, 13]. Importantly, unlike GHASH, Polyval does not perform bit reversals of the blocks. It turns out that Polyval is noticeably faster than GHASH [12]. Further, it was shown in [9] how to perform a GHASH computation using Polyval with insignificant additional computational overhead. Presently, as far as we are aware, the fastest known method to evaluate GHASH is via a corresponding Polyval computation.

The difference between GHASH and Polyval boils down to two issues. The first difference is the bit reversals of the blocks, which GHASH performs, but Polyval does not, and the second difference is that GHASH is based on usual polynomial reduction, while Polyval uses Montgomery reduction. So compared to GHASH, Polyval eliminates the bit reversals of the blocks, but replaces usual reduction with Montgomery reduction. The question that arises is the following. What happens if GHASH is modified by eliminating only the bit reversals of the blocks, but the usual reduction is retained?

The answer to the above question, it turns out, is simple. The corresponding AXU hash function is the basic polynomial evaluation based hash function over GF(2128)GF(2^{128}). Let us call this hash function to be Poly. Both Poly and Polyval are AXU hash functions and provide the same level of security. This leads to the following question. How do Poly and Polyval compare in terms of speed?

We address this question in much more generality. Both Poly and Polyval can be defined over GF(2n)GF(2^n), where nn is a positive integer. Although Poly is the basic polynomial evaluation based hash function over binary extension fields, somewhat surprisingly, Poly itself and its relation to Polyval have not been studied in the literature. The above question then becomes how do Poly and Polyval compare in speed over GF(2n)GF(2^n)? From a computational point of view, the only difference between Poly and Polyval is the type of reduction, Poly performs usual reduction, whereas Polyval performs Montgomery reduction. So the question of efficiency comparison between Poly and Polyval boils down to the following question: How do usual reduction and Montgomery reduction compare in speed over GF(2n)GF(2^n)? Answering this question forms the main technical contribution of this paper.

Present day processors provide an instruction which can perform 64-bit polynomial multiplication, i.e. such an instruction takes as input two 64-bit polynomials and produces as output the product of these two polynomials. The Intel Instrinsics name for this instruction is c1mul, while the corresponding assembly instructions are named pclmulqdq or vpc1mulqdq depending on the context of the set of registers used. For the sake of convenience, in the text we will refer to the instruction as c1mul, and in the assembly code snippets we provide the name of the actual instruction that was used.

Gueron and Kounavis [11] showed how to perform usual reduction over GF(2128)GF(2^{128}) using c1mul. This was later extended to GF(2256)GF(2^{256}) in [6]. Further, Gueron [9, 10] showed how to perform Montgomery reduction over GF(2128)GF(2^{128}) using c1mul. In particular, the method for performing usual reduction using c1mul is presently not known for values of nn other than n=128n = 128 and n=256n = 256, while the method of performing Montgomery reduction using c1mul is presently not known for any value of nn other than n=128n=128.

The present paper makes both theoretical and practical contributions to the literature. The main theoretical contribution of this paper is to provide algorithms which use c1mul to perform usual and Montgomery reductions over GF(2n)GF(2^n), for n=64kn=64k with k≥2k \geq 2. Efficiently performing such reductions require identifying appropriate forms of the irreducible polynomials in the cases of usual and Montgomery reductions. For the specific forms of the irreducible polynomials, we describe detailed algorithms along with correctness arguments, and obtain concrete counts of the numbers of different instructions that are required. Further, we identify the independent instructions in the algorithms which potentially permit parallel execution of such instructions on independent arithmetic units of the underlying processor.

It turns out that both usual reduction and Montgomery reduction require kk c1mul instructions. However, for usual reduction, k−1k-1 of the c1mul instructions are independent and can be executed in parallel, while for Montgomery reduction, the c1mul instructions have to be sequentially executed; this is a possible benefit for k>2k>2. Apart from the c1mul instructions, both the algorithms require other non-c1mul instructions. For n=128n=128 (corresponding to k=2k=2), both usual and Montgomery reductions require the same number of non-c1mul instructions, while for k>2k>2, usual reduction requires O(k)O(k) non-c1mul instructions and Montgomery reduction requires O(k2)O(k^2) non-c1mul instructions.

We analyse in further details the cases for n=64kn=64k with kk even and closely examine the assembly codes for usual reduction and Montgomery reduction for n=128n=128, n=256n=256 and n=512n=512. For n=128n=128, both usual and Montgomery reduction require 2 c1mul instructions, and also the same number of other instructions. Looking only at the operation count would suggest that both the types of reductions would result in same speed. Interestingly, however, it turns out that there is a subtle independence among the c1mul and non-c1mul instructions in Montgomery reduction, which results in such instructions being executed in parallel leading to a somewhat faster speed of Montgomery reduction compared to usual reduction.

For n=256n=256 and n=512n=512, on the other hand, even after substantial optimisation, Montgomery reduction requires significantly more non-c1mul instructions than usual reduction. Also, in these cases, k≥4k \geq 4, and as mentioned above, usual reduction provides for a number of independent c1mul instructions while such independence is absent in Montgomery reduction. As a result, it turns out that usual reduction is faster than Montgomery reduction for these values of nn. More generally, Montgomery reduction is slower than usual reduction for n=64kn=64k, with k>2k>2.

A major contribution of the present paper is to perform a performance comparison between Poly and Polyval using highly optimised assembly language implementations of these two hash functions. The implementations for Poly and Polyval have been made for n=128,256n=128,256 and 512. The difference in the speed of usual reduction and Montgomery reduction results in measureable difference in the speed of Poly and Polyval. We obtained timing measurements on three generations of Intel processors – Ivy Bridge, Tiger Lake, and Meteor Lake. These timing results validate our theoretical analysis. In particular, on all three processors, we find Polyval to be faster than Poly for n=128n=128, while Poly is faster than Polyval for n=256n=256 and n=512n=512.

The NIST is presently in the process of developing cryptographic accordions [16] which are proposed to be based on the HCTR2 [7] mode of operation. Three proposals are under consideration, namely Acc128, Acc256, and BBBAcc. HCTR2 uses 128-bit blocks, and Polyval as the hash function. Acc256 will be based on 256-bit blocks. Following the HCTR2 design requires that Acc256 will use the 256-bit variant of Polyval. Our work contributes to this approach by providing efficient assembly implementation of Polyval with 256-bit blocks. More importantly, our work shows that for 256-bit blocks, it would be faster to use Poly rather than Polyval. In particular, on Meteor Lake, the latest of the three generations of processors we considered, the speed-up of Poly over Polyval turns to be up to about 16%. So defining Acc256 with Poly instead of Polyval will provide significant speed improvement. This makes the present paper to be of current relevance as it has the potential to affect the design decision of cryptographic accordions by NIST.

Previous and related works. The notions of universal and strongly universal hash functions were introduced in the seminal papers [5, 21]. Construction of almost XOR universal hash functions based on evaluation of polynomials over a finite field was put forward by three papers [3, 4, 20]. One line of research considers the underlying finite field to be a prime order field. In this paper, we consider the other line of work which considers the underlying field to be the binary extension fields, and have extended this line of work to more general binary extension fields. For prime order fields, the most well known construction is Poly1305 [2], while for binary extension fields the most well known constructions are GHASH [14] and Polyval [12]. We refer to [1, 17] for a general overview of almost XOR universal hash functions.

Overview of the paper. Section 2 describes the preliminaries. In Section 3 we prove a result which shows that GHASH can be computed using Polyval over GF(2n)GF(2^n), for any nn; previously such a result was described for n=128n=128 in [9, Section 3.2] without a formal proof. The necessary background for field arithmetic computation is given in Section 4. Detailed algorithms and their analyses for computing usual reduction and Montgomery reduction are presented in Sections 5 and 6 respectively. A theoretical analysis of usual and Montgomery reductions for n=128,256n=128, 256 and 512 based on the corresponding assembly code is carried out in Section 7. In Section 8, we provide the detailed timing comparisons for Poly and Polyval. Finally, Section 9 concludes the paper.