You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.0 KiB

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "fr.h"
  4. int main() {
  5. FrElement a = { 0, Fr_LONGMONTGOMERY, {1,1,1,1}};
  6. FrElement b = { 0, Fr_LONGMONTGOMERY, {2,2,2,2}};
  7. /*
  8. FrElement a={0x43e1f593f0000000ULL,0x2833e84879b97091ULL,0xb85045b68181585dULL,0x30644e72e131a029ULL};
  9. FrElement b = {3,0,0,0};
  10. FrElement c;
  11. */
  12. // Fr_add(&(c[0]), a, a);
  13. // Fr_add(&(c[0]), c, b);
  14. /*
  15. for (int i=0; i<1000000000; i++) {
  16. Fr_mul(&c, &a, &b);
  17. }
  18. Fr_mul(&c,&a, &b);
  19. */
  20. FrElement a1[10];
  21. FrElement a2[10];
  22. for (int i=0; i<10; i++) {
  23. a1[i].type = Fr_LONGMONTGOMERY;
  24. a1[i].shortVal =0;
  25. for (int j=0; j<Fr_N64; j++) {
  26. a2[i].longVal[j] = i;
  27. }
  28. }
  29. Fr_copyn(a2, a1, 10);
  30. for (int i=0; i<10; i++) {
  31. char *c1 = Fr_element2str(&a1[i]);
  32. char *c2 = Fr_element2str(&a2[i]);
  33. printf("%s\n%s\n\n", c1, c2);
  34. free(c1);
  35. free(c2);
  36. }
  37. // printf("%llu, %llu, %llu, %llu\n", c.longVal[0], c.longVal[1], c.longVal[2], c.longVal[3]);
  38. }