Getting ready for v0.43.0 release
Also updated my email address... Signed-off-by: Tom St Denis <tstdenis82@gmail.com>
This commit is contained in:
		
							parent
							
								
									7916c4035b
								
							
						
					
					
						commit
						079b0f65a9
					
				
							
								
								
									
										4
									
								
								bn.tex
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								bn.tex
									
									
									
									
									
								
							| @ -49,8 +49,8 @@ | ||||
| \begin{document} | ||||
| \frontmatter | ||||
| \pagestyle{empty} | ||||
| \title{LibTomMath User Manual \\ v0.42.0} | ||||
| \author{Tom St Denis \\ tomstdenis@gmail.com} | ||||
| \title{LibTomMath User Manual \\ v0.43.0} | ||||
| \author{Tom St Denis \\ tstdenis82@gmail.com} | ||||
| \maketitle | ||||
| This text, the library and the accompanying textbook are all hereby placed in the public domain.  This book has been  | ||||
| formatted for B5 [176x250] paper using the \LaTeX{} {\em book} macro package. | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| static const struct { | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes the modular inverse via binary extended euclidean algorithm, 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes xR**-1 == x (mod N) via Montgomery Reduction
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* Fast (comba) multiplier
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* this is a modified version of fast_s_mul_digs that only produces
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* the jist of squaring...
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes a = 2**b 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* b = |a| 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* high level addition (handles signs) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* single digit addition */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* d = a + b (mod c) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* AND two ints together */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* trim unused digits 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* clear one (frees)  */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| #include <stdarg.h> | ||||
| 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* compare two ints (signed)*/ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* compare a digit */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* compare maginitude of two ints (unsigned) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| static const int lnz[16] = {  | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* copy, b = a */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* returns the number of bits in an int */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| #ifdef BN_MP_DIV_SMALL | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* b = a/2 */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* divide by three (based on routine from MPI and the GMP manual) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| static int s_is_power_of_two(mp_digit b, int *p) | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines if a number is a valid DR modulus */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* reduce "x" in place modulo "n" using the Diminished Radix algorithm.
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines the setup value */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* swap the elements of two integers, for cases where you can't simply swap the 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* based on gmp's mpz_export.
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* wrapper function for mp_expt_d_ex() */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* calculate c = a**b  using a square-multiply algorithm */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* Extended euclidean algorithm of (a, b) produces 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* read a bigint from a file stream in ASCII */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| int mp_fwrite(mp_int *a, int radix, FILE *stream) | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* Greatest Common Divisor using the binary method */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* get the lower 32-bits of an mp_int */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* get the lower unsigned long of an mp_int, platform dependent */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* get the lower unsigned long long of an mp_int, platform dependent */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* grow as required */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* based on gmp's mpz_import.
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* init a new mp_int */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* creates "a" then copies b into it */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| #include <stdarg.h> | ||||
| 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* initialize and set a digit */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* initialize and set a digit */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* init an mp_init for a given size */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* hac 14.61, pp608 */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* hac 14.61, pp608 */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* Check if remainders are possible squares - fast exclude non-squares */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes the jacobi c = (a | n) (or Legendre if n is prime)
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* c = |a| * |b| using Karatsuba Multiplication using 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* Karatsuba squaring, computes b = a*a using three 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes least common multiple as |a*b|/(a, b) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* shift left a certain amount of digits */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* calc a value mod 2**b */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| int | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /*
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* computes xR**-1 == x (mod N) via Montgomery Reduction */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* setups the montgomery reduction stuff */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* high level multiplication (handles sign) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* b = a*2 */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* shift left by a certain bit count */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* multiply by a digit */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* d = a * b (mod c) */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* wrapper function for mp_n_root_ex()
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* find the n'th root of an integer
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* b = -a */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* OR two ints together */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* performs one Fermat test.
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines if an integers is divisible by one 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* performs a variable number of rounds of Miller-Rabin
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* Miller-Rabin test of "a" to the base of "b" as described in 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* finds the next prime after the number "a" using "t" trials
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* makes a truly random prime of a given size (bits),
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* returns size of ASCII reprensentation */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* chars used in radix conversions */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* makes a pseudo-random int of a given size */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* read a string [ASCII] in a given radix */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* read signed bin, big endian, first byte is 0==positive or 1==negative */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* reads a unsigned char array, assumes the msb is stored first [big endian] */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* reduces x mod m, assumes 0 < x < m**2, mu is
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* reduces a modulo n where n is of the form 2**p - d */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* reduces a modulo n where n is of the form 2**p - d 
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines the setup value */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines the setup value */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines if mp_reduce_2k can be used */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* determines if reduce_2k_l can be used */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* pre-calculate the value required for Barrett reduction
 | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* shift right a certain amount of digits */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* set to a digit */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* set a 32-bit const */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* set a platform dependent unsigned long int */ | ||||
|  | ||||
| @ -12,7 +12,7 @@ | ||||
|  * The library is free for all purposes without any express | ||||
|  * guarantee it works. | ||||
|  * | ||||
|  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 | ||||
|  * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
 | ||||
|  */ | ||||
| 
 | ||||
| /* set a platform dependent unsigned long long int */ | ||||
|  | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user