Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

  1. #include <stdint.h>
  2. #include "params.h"
  3. #include "poly.h"
  4. #include "ntt.h"
  5. #include "reduce.h"
  6. /*************************************************
  7. * Name: poly_ntt
  8. *
  9. * Description: Computes negacyclic number-theoretic transform (NTT) of
  10. * a polynomial in place;
  11. * inputs assumed to be in normal order, output in bitreversed order
  12. *
  13. * Arguments: - uint16_t *r: pointer to in/output polynomial
  14. **************************************************/
  15. void poly_ntt(poly *r)
  16. {
  17. ntt(r->coeffs);
  18. poly_reduce(r);
  19. }
  20. /*************************************************
  21. * Name: poly_reduce
  22. *
  23. * Description: Applies Barrett reduction to all coefficients of a polynomial
  24. * for details of the Barrett reduction see comments in reduce.c
  25. *
  26. * Arguments: - poly *r: pointer to input/output polynomial
  27. **************************************************/
  28. void poly_reduce(poly *r)
  29. {
  30. int i;
  31. for(i=0;i<KYBER_N;i++)
  32. r->coeffs[i] = barrett_reduce(r->coeffs[i]);
  33. }