A computer-readable medium storing a sequence of instructions that when executed cause a computer to perform a cryptographic method of multiplying a first polynomial and a second polynomial over a finite field having 2m elements, wherein m is a positive integer, the method comprising:
- representing the first polynomial and the second polynomial as an array of n words having a size of at least two bits, wherein n is an integer;
- using a recursive algorithm to decompose a multiplication of the first polynomial and the second polynomial into a weighted sum of iteratively smaller subproducts;
- and
- using a nonrecursive algorithm to complete the multiplication when a size of the smaller subproducts is less than or equal to a predetermined size, the predetermined size being at least two words;
- and
- storing a cryptographic parameter associated with the multiplication in a memory.