comparison libtommath/mtest/mtest.c @ 1470:8bba51a55704

Update to libtommath v1.0.1
author Matt Johnston <matt@ucc.asn.au>
date Thu, 08 Feb 2018 23:11:40 +0800
parents 60fc6476e044
children
comparison
equal deleted inserted replaced
1469:51043e868f55 1470:8bba51a55704
305 printf("%s\n", buf); 305 printf("%s\n", buf);
306 mp_to64(&d, buf); 306 mp_to64(&d, buf);
307 printf("%s\n", buf); 307 printf("%s\n", buf);
308 } else if (n == 10) { 308 } else if (n == 10) {
309 /* invmod test */ 309 /* invmod test */
310 do {
310 rand_num2(&a); 311 rand_num2(&a);
311 rand_num2(&b); 312 rand_num2(&b);
312 b.sign = MP_ZPOS; 313 b.sign = MP_ZPOS;
313 a.sign = MP_ZPOS; 314 a.sign = MP_ZPOS;
314 mp_gcd(&a, &b, &c); 315 mp_gcd(&a, &b, &c);
315 if (mp_cmp_d(&c, 1) != 0) continue; 316 } while (mp_cmp_d(&c, 1) != 0 || mp_cmp_d(&b, 1) == 0);
316 if (mp_cmp_d(&b, 1) == 0) continue;
317 mp_invmod(&a, &b, &c); 317 mp_invmod(&a, &b, &c);
318 printf("invmod\n"); 318 printf("invmod\n");
319 mp_to64(&a, buf); 319 mp_to64(&a, buf);
320 printf("%s\n", buf); 320 printf("%s\n", buf);
321 mp_to64(&b, buf); 321 mp_to64(&b, buf);