GiacomoPope / kyber-py

A pure python implementation of ML-KEM (FIPS 203) and CRYSTALS-Kyber
MIT License
201 stars 47 forks source link

polynomials: create coefficients in cbd from an iterator #79

Closed tomato42 closed 3 months ago

tomato42 commented 3 months ago

trying out if a slight optimisation on the CBD doesn't improve situation but it's basically no difference:

current main:

--------------------------------------------------------------------------------
   Params    |  keygen  |  keygen/s  |  encap  |  encap/s  |  decap  |  decap/s
--------------------------------------------------------------------------------
 ML-KEM-512  |   0.99ms |    1010.07 |  1.47ms |    681.81 |  2.10ms |  477.19 |
 ML-KEM-768  |   1.69ms |     592.47 |  2.27ms |    439.71 |  3.11ms |  321.56 |
 ML-KEM-1024 |   2.55ms |     392.77 |  3.24ms |    309.07 |  4.27ms |  234.14 |

this PR:

--------------------------------------------------------------------------------
   Params    |  keygen  |  keygen/s  |  encap  |  encap/s  |  decap  |  decap/s
--------------------------------------------------------------------------------
 ML-KEM-512  |   1.00ms |    1004.16 |  1.48ms |    677.70 |  2.10ms |  476.19 |
 ML-KEM-768  |   1.70ms |     589.87 |  2.29ms |    437.49 |  3.12ms |  320.72 |
 ML-KEM-1024 |   2.56ms |     390.77 |  3.25ms |    307.83 |  4.28ms |  233.67 |