Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

41 строка
1.8 KiB

  1. #ifndef MQDSS_GF31_H
  2. #define MQDSS_GF31_H
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. typedef uint16_t gf31;
  6. /* This performs a full unique reduction mod 13 on x; x can be any unsigned
  7. 16-bit integer (i.e. in the range [0, 65535]) */
  8. gf31 PQCLEAN_MQDSS64_CLEAN_mod31(gf31 x);
  9. /* Given a vector of elements in the range [0, 31], this reduces the elements
  10. to the range [0, 30] by mapping 31 to 0 (i.e reduction mod 31) */
  11. void PQCLEAN_MQDSS64_CLEAN_vgf31_unique(gf31 *out, const gf31 *in);
  12. /* Given a vector of 16-bit integers (i.e. in [0, 65535], this reduces the
  13. elements to the range [0, 30] by mapping 31 to 0 (i.e reduction mod 31) */
  14. void PQCLEAN_MQDSS64_CLEAN_vgf31_shorten_unique(gf31 *out, const gf31 *in);
  15. /* Given a seed, samples len gf31 elements (in the range [0, 30]), and places
  16. them in a vector of 16-bit elements */
  17. void PQCLEAN_MQDSS64_CLEAN_gf31_nrand(gf31 *out, int len, const unsigned char *seed, size_t seedlen);
  18. /* Given a seed, samples len gf31 elements, transposed into unsigned range,
  19. i.e. in the range [-15, 15], and places them in an array of 8-bit integers.
  20. This is used for the expansion of F, which wants packed elements. */
  21. void PQCLEAN_MQDSS64_CLEAN_gf31_nrand_schar(signed char *out, int len, const unsigned char *seed, size_t seedlen);
  22. /* Unpacks an array of packed GF31 elements to one element per gf31.
  23. Assumes that there is sufficient empty space available at the end of the
  24. array to unpack. Can perform in-place. */
  25. void PQCLEAN_MQDSS64_CLEAN_gf31_nunpack(gf31 *out, const unsigned char *in, unsigned int n);
  26. /* Packs an array of GF31 elements from gf31's to concatenated 5-bit values.
  27. Assumes that there is sufficient space available to unpack.
  28. Can perform in-place. */
  29. void PQCLEAN_MQDSS64_CLEAN_gf31_npack(unsigned char *out, const gf31 *in, unsigned int n);
  30. #endif