nucypher / DarkIntegers.jl

A modulo arithmetic toolbox for integers and polynomials
https://nucypher.github.io/DarkIntegers.jl
GNU General Public License v3.0
7 stars 2 forks source link

Investigate ADK multiplication further #5

Open fjarri opened 4 years ago

fjarri commented 4 years ago

The branch adk_mul contains an implementation of arbitrary degree Karatsuba (ADK), in polynomials.jl::adk_mul().

Sources:

  1. "Missing a trick: Karatsuba variations" by M. Scott (https://miracl.com/assets/pdf-downloads/sk-1.pdf)
  2. "Generalizations of the Karatsuba Algorithm for Efficient Implementations" by A. Weimerskirch and C. Paar (https://eprint.iacr.org/2006/224.pdf)

It is faster than mul_naive() and even mul_karatsuba for small polynomial sizes (still N^2 complexity though, so Karatsuba wins for larger sizes). It also does not require the polynomial size to be a power of 2.

It may be possible to get rid of the additional buffer requirement, in which case it will become even faster.