Re: Dividing 512 bit number by 128 bit number in C program
- From: "Christian Siebert" <iBBiS@xxxxxx>
- Date: 23 Dec 2006 02:45:37 -0800
I have a huge problem finding " a mod m " using C program, when m isWhy don't you simply use one of the big-integer libraries? Here is an
128 bit number and a is 512 bit number. Can anybody suggest me a
solution.
example:
/* gcc -O2 -lgmp a_mod_m.c -o a_mod_m */
#include <stdio.h>
#include <gmp.h>
int main(int argc, char *argv[])
{
mpz_t a, m, r;
int base = 10;
if (argc == 3) {
mpz_init_set_str(a, argv[1], base);
mpz_init_set_str(m, argv[2], base);
mpz_init(r);
mpz_mod(r, a, m);
gmp_printf("%Zd\n", r);
}
else puts("usage: a_mod_m <integer 'a'> <integer 'm'>");
return 0;
}
.
- References:
- Dividing 512 bit number by 128 bit number in C program
- From: vaidehikedlaya
- Dividing 512 bit number by 128 bit number in C program
- Prev by Date: Re: Please Help: x.509 Certificates Library or non-certificate authentication
- Next by Date: Re: Please Help: x.509 Certificates Library or non-certificate authentication
- Previous by thread: Re: Dividing 512 bit number by 128 bit number in C program
- Next by thread: Re: Dividing 512 bit number by 128 bit number in C program
- Index(es):
Relevant Pages
|