dougreed
Member
Hi all,
I'm writing a little RSA cipher program in C for the heck of it, and came across the issue of calculating the modulus of large numbers (e.g. 17^263 % 14351). "long long int" variables are not big enough for my purposes, and the modulo operator expects two ints, so even if "long long int" were big enough I'd have to cast the result to type int anyway.
Does anyone have any ideas as to how I can calculate these large numbers? I can do it by hand, and I suppose I can turn the algorithm I know on paper into some C code, but that really seems like a lot of trouble.
-Doug
I'm writing a little RSA cipher program in C for the heck of it, and came across the issue of calculating the modulus of large numbers (e.g. 17^263 % 14351). "long long int" variables are not big enough for my purposes, and the modulo operator expects two ints, so even if "long long int" were big enough I'd have to cast the result to type int anyway.
Does anyone have any ideas as to how I can calculate these large numbers? I can do it by hand, and I suppose I can turn the algorithm I know on paper into some C code, but that really seems like a lot of trouble.
-Doug