trim trailing spaces/clean up

This commit is contained in:
Steffen Jaeckel 2014-09-02 02:14:38 +02:00
parent 6fc385081e
commit 0213986c7b
12 changed files with 1131 additions and 7959 deletions

2
.gitignore vendored
View File

@ -37,3 +37,5 @@ mtest.exe
*.ilg
*.ind
*.pdf
*.out
tommath.tex

View File

@ -16,7 +16,7 @@
*/
/* get the lower 32-bits of an mp_int */
unsigned long mp_get_int(mp_int * a)
unsigned long mp_get_int(mp_int * a)
{
int i;
unsigned long res;
@ -30,7 +30,7 @@ unsigned long mp_get_int(mp_int * a)
/* get most significant digit of result */
res = DIGIT(a,i);
while (--i >= 0) {
res = (res << DIGIT_BIT) | DIGIT(a,i);
}

View File

@ -15,7 +15,7 @@
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
/* reduces x mod m, assumes 0 < x < m**2, mu is
/* reduces x mod m, assumes 0 < x < m**2, mu is
* precomputed via mp_reduce_setup.
* From HAC pp.604 Algorithm 14.42
*/
@ -30,7 +30,7 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
}
/* q1 = x / b**(k-1) */
mp_rshd (&q, um - 1);
mp_rshd (&q, um - 1);
/* according to HAC this optimization is ok */
if (((unsigned long) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) {
@ -46,8 +46,8 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {
goto CLEANUP;
}
#else
{
#else
{
res = MP_VAL;
goto CLEANUP;
}
@ -55,7 +55,7 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
}
/* q3 = q2 / b**(k+1) */
mp_rshd (&q, um + 1);
mp_rshd (&q, um + 1);
/* x = x mod b**(k+1), quick (no division) */
if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) {
@ -87,7 +87,7 @@ int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
goto CLEANUP;
}
}
CLEANUP:
mp_clear (&q);

View File

@ -15,7 +15,7 @@ if (shift =~ /PDF/) {
$graph = "";
} else {
$graph = ".ps";
}
}
open(IN,"<tommath.src") or die "Can't open source file";
open(OUT,">tommath.tex") or die "Can't open destination file";
@ -26,7 +26,7 @@ $x = 0;
while (<IN>) {
print ".";
if (!(++$x % 80)) { print "\n"; }
#update the headings
#update the headings
if (~($_ =~ /\*/)) {
if ($_ =~ /\\chapter{.+}/) {
++$chapter;
@ -37,7 +37,7 @@ while (<IN>) {
} elsif ($_ =~ /\\subsection{.+}/) {
++$subsection;
}
}
}
if ($_ =~ m/MARK/) {
@m = split(",",$_);
@ -56,7 +56,7 @@ $srcline = 0;
while (<IN>) {
++$readline;
++$srcline;
if ($_ =~ m/MARK/) {
} elsif ($_ =~ m/EXAM/ || $_ =~ m/LIST/) {
if ($_ =~ m/EXAM/) {
@ -64,29 +64,29 @@ while (<IN>) {
} else {
$skipheader = 0;
}
# EXAM,file
chomp($_);
@m = split(",",$_);
open(SRC,"<$m[1]") or die "Error:$srcline:Can't open source file $m[1]";
print "$srcline:Inserting $m[1]:";
$line = 0;
$tmp = $m[1];
$tmp =~ s/_/"\\_"/ge;
print OUT "\\vspace{+3mm}\\begin{small}\n\\hspace{-5.1mm}{\\bf File}: $tmp\n\\vspace{-3mm}\n\\begin{alltt}\n";
$wroteline += 5;
if ($skipheader == 1) {
# scan till next end of comment, e.g. skip license
# scan till next end of comment, e.g. skip license
while (<SRC>) {
$text[$line++] = $_;
last if ($_ =~ /math\.libtomcrypt\.com/);
}
<SRC>;
<SRC>;
}
$inline = 0;
while (<SRC>) {
next if ($_ =~ /\$Source/);
@ -100,11 +100,11 @@ while (<IN>) {
$_ =~ s/}/"^}"/ge;
$_ =~ s/\\/'\symbol{92}'/ge;
$_ =~ s/\^/"\\"/ge;
printf OUT ("%03d ", $line);
for ($x = 0; $x < length($_); $x++) {
print OUT chr(vec($_, $x, 8));
if ($x == 75) {
if ($x == 75) {
print OUT "\n ";
++$wroteline;
}
@ -123,9 +123,9 @@ while (<IN>) {
$txt = $_;
while ($txt =~ m/@\d+,.+@/) {
@m = split("@",$txt); # splits into text, one, two
@parms = split(",",$m[1]); # splits one,two into two elements
# now search from $parms[0] down for $parms[1]
@parms = split(",",$m[1]); # splits one,two into two elements
# now search from $parms[0] down for $parms[1]
$found1 = 0;
$found2 = 0;
for ($i = $parms[0]; $i < $totlines && $found1 == 0; $i++) {
@ -134,7 +134,7 @@ while (<IN>) {
$found1 = 1;
}
}
# now search backwards
for ($i = $parms[0] - 1; $i >= 0 && $found2 == 0; $i--) {
if ($text[$i] =~ m/\Q$parms[1]\E/) {
@ -142,7 +142,7 @@ while (<IN>) {
$found2 = 1;
}
}
# now use the closest match or the first if tied
if ($found1 == 1 && $found2 == 0) {
$found = 1;
@ -160,8 +160,8 @@ while (<IN>) {
} else {
$found = 0;
}
# if found replace
# if found replace
if ($found == 1) {
$delta = $parms[0] - $foundline;
print "Found replacement tag for \"$parms[1]\" on line $srcline which refers to line $foundline (delta $delta)\n";
@ -169,8 +169,8 @@ while (<IN>) {
} else {
print "ERROR: The tag \"$parms[1]\" on line $srcline was not found in the most recently parsed source!\n";
}
# remake the rest of the line
# remake the rest of the line
$cnt = @m;
$txt = "";
for ($i = 2; $i < $cnt; $i++) {
@ -184,13 +184,13 @@ while (<IN>) {
$txt = $_;
while ($txt =~ /~.+~/) {
@m = split("~", $txt);
# word is the second position
$word = @m[1];
$a = $index1{$word};
$b = $index2{$word};
$c = $index3{$word};
# if chapter (a) is zero it wasn't found
if ($a == 0) {
print "ERROR: the tag \"$word\" on line $srcline was not found previously marked.\n";
@ -199,7 +199,7 @@ while (<IN>) {
$str = $a;
$str = $str . ".$b" if ($b != 0);
$str = $str . ".$c" if ($c != 0);
if ($b == 0 && $c == 0) {
# its a chapter
if ($a <= 10) {
@ -228,16 +228,16 @@ while (<IN>) {
$str = "chapter " . $str;
}
} else {
$str = "section " . $str if ($b != 0 && $c == 0);
$str = "section " . $str if ($b != 0 && $c == 0);
$str = "sub-section " . $str if ($b != 0 && $c != 0);
}
#substitute
$_ =~ s/~\Q$word\E~/$str/;
print "Found replacement tag for marker \"$word\" on line $srcline which refers to $str\n";
}
# remake rest of the line
$cnt = @m;
$txt = "";

View File

@ -6,7 +6,7 @@
#include <time.h>
/* how many times todo each size mult. Depends on your computer. For slow computers
* this can be low like 5 or 10. For fast [re: Athlon] should be 25 - 50 or so
* this can be low like 5 or 10. For fast [re: Athlon] should be 25 - 50 or so
*/
#define TIMES (1UL<<14UL)
@ -67,7 +67,7 @@ ulong64 time_mult(int size, int s)
mp_rand (&a, size);
mp_rand (&b, size);
if (s == 1) {
if (s == 1) {
KARATSUBA_MUL_CUTOFF = size;
} else {
KARATSUBA_MUL_CUTOFF = 100000;
@ -95,7 +95,7 @@ ulong64 time_sqr(int size, int s)
mp_rand (&a, size);
if (s == 1) {
if (s == 1) {
KARATSUBA_SQR_CUTOFF = size;
} else {
KARATSUBA_SQR_CUTOFF = 100000;
@ -117,7 +117,7 @@ main (void)
ulong64 t1, t2;
int x, y;
for (x = 8; ; x += 2) {
for (x = 8; ; x += 2) {
t1 = time_mult(x, 0);
t2 = time_mult(x, 1);
printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1);
@ -125,7 +125,7 @@ main (void)
}
y = x;
for (x = 8; ; x += 2) {
for (x = 8; ; x += 2) {
t1 = time_sqr(x, 0);
t2 = time_sqr(x, 1);
printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1);

View File

@ -2,7 +2,7 @@
#
#Tom St Denis
#version of library
#version of library
VERSION=0.42.0
CFLAGS += -I./ -Wall -W -Wshadow -Wsign-compare
@ -23,10 +23,10 @@ endif
ifndef IGNORE_SPEED
#for speed
#for speed
CFLAGS += -O3 -funroll-loops
#for size
#for size
#CFLAGS += -Os
#x86 optimizations [should be valid for any GCC install though]
@ -104,7 +104,7 @@ $(LIBNAME): $(OBJECTS)
#
# This will build the library with profile generation
# then run the test demo and rebuild the library.
#
#
# So far I've seen improvements in the MP math
profiled:
make CFLAGS="$(CFLAGS) -fprofile-arcs -DTESTING" timing
@ -112,7 +112,7 @@ profiled:
rm -f *.a *.o ltmtest
make CFLAGS="$(CFLAGS) -fbranch-probabilities"
#make a single object profiled library
#make a single object profiled library
profiled_single:
perl gen.pl
$(CC) $(CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o
@ -121,7 +121,7 @@ profiled_single:
rm -f *.o ltmtest
$(CC) $(CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o
$(AR) $(ARFLAGS) $(LIBNAME) mpi.o
ranlib $(LIBNAME)
ranlib $(LIBNAME)
install: $(LIBNAME)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
@ -131,16 +131,16 @@ install: $(LIBNAME)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) -o test
mtest: test
cd mtest ; $(CC) $(CFLAGS) mtest.c -o mtest
timing: $(LIBNAME)
$(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o ltmtest
# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
docdvi: tommath.src
cd pics ; MAKE=${MAKE} ${MAKE}
cd pics ; MAKE=${MAKE} ${MAKE}
echo "hello" > tommath.ind
perl booker.pl
latex tommath > /dev/null
@ -151,14 +151,14 @@ docdvi: tommath.src
# poster, makes the single page PDF poster
poster: poster.tex
pdflatex poster
rm -f poster.aux poster.log
rm -f poster.aux poster.log
# makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files
docs: docdvi
dvipdf tommath
rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg
cd pics ; MAKE=${MAKE} ${MAKE} clean
#LTM user manual
mandvi: bn.tex
echo "hello" > bn.ind
@ -172,7 +172,7 @@ manual: mandvi
pdflatex bn >/dev/null
rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc
pretty:
pretty:
perl pretty.build
clean:
@ -184,7 +184,7 @@ clean:
#zipup the project (take that!)
no_oops: clean
cd .. ; cvs commit
cd .. ; cvs commit
echo Scanning for scratch/dirty files
find . -type f | grep -v CVS | xargs -n 1 bash mess.sh

View File

@ -8,7 +8,7 @@
CFLAGS += -I./ -Wall -W -Wshadow -O3 -funroll-loops -mno-cygwin
#x86 optimizations [should be valid for any GCC install though]
CFLAGS += -fomit-frame-pointer
CFLAGS += -fomit-frame-pointer
default: windll

View File

@ -11,7 +11,7 @@ CFLAGS += -I./
# -ax? specifies make code specifically for ? but compatible with IA-32
# -x? specifies compile solely for ? [not specifically IA-32 compatible]
#
# where ? is
# where ? is
# K - PIII
# W - first P4 [Williamette]
# N - P4 Northwood
@ -75,7 +75,7 @@ libtommath.a: $(OBJECTS)
#
# This will build the library with profile generation
# then run the test demo and rebuild the library.
#
#
# So far I've seen improvements in the MP math
profiled:
make -f makefile.icc CFLAGS="$(CFLAGS) -prof_gen -DTESTING" timing
@ -83,7 +83,7 @@ profiled:
rm -f *.a *.o ltmtest
make -f makefile.icc CFLAGS="$(CFLAGS) -prof_use"
#make a single object profiled library
#make a single object profiled library
profiled_single:
perl gen.pl
$(CC) $(CFLAGS) -prof_gen -DTESTING -c mpi.c -o mpi.o
@ -92,7 +92,7 @@ profiled_single:
rm -f *.o ltmtest
$(CC) $(CFLAGS) -prof_use -ip -DTESTING -c mpi.c -o mpi.o
$(AR) $(ARFLAGS) libtommath.a mpi.o
ranlib libtommath.a
ranlib libtommath.a
install: libtommath.a
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
@ -102,10 +102,10 @@ install: libtommath.a
test: libtommath.a demo/demo.o
$(CC) demo/demo.o libtommath.a -o test
mtest: test
mtest: test
cd mtest ; $(CC) $(CFLAGS) mtest.c -o mtest
timing: libtommath.a
$(CC) $(CFLAGS) -DTIMER demo/timing.c libtommath.a -o ltmtest

View File

@ -98,7 +98,7 @@ install: $(LIBNAME)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
$(LT) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME_S)
mtest: test
cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest

View File

@ -1,139 +0,0 @@
\BOOKMARK [0][-]{chapter.1}{Introduction}{}
\BOOKMARK [1][-]{section.1.1}{Multiple Precision Arithmetic}{chapter.1}
\BOOKMARK [2][-]{subsection.1.1.1}{What is Multiple Precision Arithmetic?}{section.1.1}
\BOOKMARK [2][-]{subsection.1.1.2}{The Need for Multiple Precision Arithmetic}{section.1.1}
\BOOKMARK [2][-]{subsection.1.1.3}{Benefits of Multiple Precision Arithmetic}{section.1.1}
\BOOKMARK [1][-]{section.1.2}{Purpose of This Text}{chapter.1}
\BOOKMARK [1][-]{section.1.3}{Discussion and Notation}{chapter.1}
\BOOKMARK [2][-]{subsection.1.3.1}{Notation}{section.1.3}
\BOOKMARK [2][-]{subsection.1.3.2}{Precision Notation}{section.1.3}
\BOOKMARK [2][-]{subsection.1.3.3}{Algorithm Inputs and Outputs}{section.1.3}
\BOOKMARK [2][-]{subsection.1.3.4}{Mathematical Expressions}{section.1.3}
\BOOKMARK [2][-]{subsection.1.3.5}{Work Effort}{section.1.3}
\BOOKMARK [1][-]{section.1.4}{Exercises}{chapter.1}
\BOOKMARK [1][-]{section.1.5}{Introduction to LibTomMath}{chapter.1}
\BOOKMARK [2][-]{subsection.1.5.1}{What is LibTomMath?}{section.1.5}
\BOOKMARK [2][-]{subsection.1.5.2}{Goals of LibTomMath}{section.1.5}
\BOOKMARK [1][-]{section.1.6}{Choice of LibTomMath}{chapter.1}
\BOOKMARK [2][-]{subsection.1.6.1}{Code Base}{section.1.6}
\BOOKMARK [2][-]{subsection.1.6.2}{API Simplicity}{section.1.6}
\BOOKMARK [2][-]{subsection.1.6.3}{Optimizations}{section.1.6}
\BOOKMARK [2][-]{subsection.1.6.4}{Portability and Stability}{section.1.6}
\BOOKMARK [2][-]{subsection.1.6.5}{Choice}{section.1.6}
\BOOKMARK [0][-]{chapter.2}{Getting Started}{}
\BOOKMARK [1][-]{section.2.1}{Library Basics}{chapter.2}
\BOOKMARK [1][-]{section.2.2}{What is a Multiple Precision Integer?}{chapter.2}
\BOOKMARK [2][-]{subsection.2.2.1}{The mp\137int Structure}{section.2.2}
\BOOKMARK [1][-]{section.2.3}{Argument Passing}{chapter.2}
\BOOKMARK [1][-]{section.2.4}{Return Values}{chapter.2}
\BOOKMARK [1][-]{section.2.5}{Initialization and Clearing}{chapter.2}
\BOOKMARK [2][-]{subsection.2.5.1}{Initializing an mp\137int}{section.2.5}
\BOOKMARK [2][-]{subsection.2.5.2}{Clearing an mp\137int}{section.2.5}
\BOOKMARK [1][-]{section.2.6}{Maintenance Algorithms}{chapter.2}
\BOOKMARK [2][-]{subsection.2.6.1}{Augmenting an mp\137int's Precision}{section.2.6}
\BOOKMARK [2][-]{subsection.2.6.2}{Initializing Variable Precision mp\137ints}{section.2.6}
\BOOKMARK [2][-]{subsection.2.6.3}{Multiple Integer Initializations and Clearings}{section.2.6}
\BOOKMARK [2][-]{subsection.2.6.4}{Clamping Excess Digits}{section.2.6}
\BOOKMARK [0][-]{chapter.3}{Basic Operations}{}
\BOOKMARK [1][-]{section.3.1}{Introduction}{chapter.3}
\BOOKMARK [1][-]{section.3.2}{Assigning Values to mp\137int Structures}{chapter.3}
\BOOKMARK [2][-]{subsection.3.2.1}{Copying an mp\137int}{section.3.2}
\BOOKMARK [2][-]{subsection.3.2.2}{Creating a Clone}{section.3.2}
\BOOKMARK [1][-]{section.3.3}{Zeroing an Integer}{chapter.3}
\BOOKMARK [1][-]{section.3.4}{Sign Manipulation}{chapter.3}
\BOOKMARK [2][-]{subsection.3.4.1}{Absolute Value}{section.3.4}
\BOOKMARK [2][-]{subsection.3.4.2}{Integer Negation}{section.3.4}
\BOOKMARK [1][-]{section.3.5}{Small Constants}{chapter.3}
\BOOKMARK [2][-]{subsection.3.5.1}{Setting Small Constants}{section.3.5}
\BOOKMARK [2][-]{subsection.3.5.2}{Setting Large Constants}{section.3.5}
\BOOKMARK [1][-]{section.3.6}{Comparisons}{chapter.3}
\BOOKMARK [2][-]{subsection.3.6.1}{Unsigned Comparisions}{section.3.6}
\BOOKMARK [2][-]{subsection.3.6.2}{Signed Comparisons}{section.3.6}
\BOOKMARK [0][-]{chapter.4}{Basic Arithmetic}{}
\BOOKMARK [1][-]{section.4.1}{Introduction}{chapter.4}
\BOOKMARK [1][-]{section.4.2}{Addition and Subtraction}{chapter.4}
\BOOKMARK [2][-]{subsection.4.2.1}{Low Level Addition}{section.4.2}
\BOOKMARK [2][-]{subsection.4.2.2}{Low Level Subtraction}{section.4.2}
\BOOKMARK [2][-]{subsection.4.2.3}{High Level Addition}{section.4.2}
\BOOKMARK [2][-]{subsection.4.2.4}{High Level Subtraction}{section.4.2}
\BOOKMARK [1][-]{section.4.3}{Bit and Digit Shifting}{chapter.4}
\BOOKMARK [2][-]{subsection.4.3.1}{Multiplication by Two}{section.4.3}
\BOOKMARK [2][-]{subsection.4.3.2}{Division by Two}{section.4.3}
\BOOKMARK [1][-]{section.4.4}{Polynomial Basis Operations}{chapter.4}
\BOOKMARK [2][-]{subsection.4.4.1}{Multiplication by x}{section.4.4}
\BOOKMARK [2][-]{subsection.4.4.2}{Division by x}{section.4.4}
\BOOKMARK [1][-]{section.4.5}{Powers of Two}{chapter.4}
\BOOKMARK [2][-]{subsection.4.5.1}{Multiplication by Power of Two}{section.4.5}
\BOOKMARK [2][-]{subsection.4.5.2}{Division by Power of Two}{section.4.5}
\BOOKMARK [2][-]{subsection.4.5.3}{Remainder of Division by Power of Two}{section.4.5}
\BOOKMARK [0][-]{chapter.5}{Multiplication and Squaring}{}
\BOOKMARK [1][-]{section.5.1}{The Multipliers}{chapter.5}
\BOOKMARK [1][-]{section.5.2}{Multiplication}{chapter.5}
\BOOKMARK [2][-]{subsection.5.2.1}{The Baseline Multiplication}{section.5.2}
\BOOKMARK [2][-]{subsection.5.2.2}{Faster Multiplication by the ``Comba'' Method}{section.5.2}
\BOOKMARK [2][-]{subsection.5.2.3}{Polynomial Basis Multiplication}{section.5.2}
\BOOKMARK [2][-]{subsection.5.2.4}{Karatsuba Multiplication}{section.5.2}
\BOOKMARK [2][-]{subsection.5.2.5}{Toom-Cook 3-Way Multiplication}{section.5.2}
\BOOKMARK [2][-]{subsection.5.2.6}{Signed Multiplication}{section.5.2}
\BOOKMARK [1][-]{section.5.3}{Squaring}{chapter.5}
\BOOKMARK [2][-]{subsection.5.3.1}{The Baseline Squaring Algorithm}{section.5.3}
\BOOKMARK [2][-]{subsection.5.3.2}{Faster Squaring by the ``Comba'' Method}{section.5.3}
\BOOKMARK [2][-]{subsection.5.3.3}{Polynomial Basis Squaring}{section.5.3}
\BOOKMARK [2][-]{subsection.5.3.4}{Karatsuba Squaring}{section.5.3}
\BOOKMARK [2][-]{subsection.5.3.5}{Toom-Cook Squaring}{section.5.3}
\BOOKMARK [2][-]{subsection.5.3.6}{High Level Squaring}{section.5.3}
\BOOKMARK [0][-]{chapter.6}{Modular Reduction}{}
\BOOKMARK [1][-]{section.6.1}{Basics of Modular Reduction}{chapter.6}
\BOOKMARK [1][-]{section.6.2}{The Barrett Reduction}{chapter.6}
\BOOKMARK [2][-]{subsection.6.2.1}{Fixed Point Arithmetic}{section.6.2}
\BOOKMARK [2][-]{subsection.6.2.2}{Choosing a Radix Point}{section.6.2}
\BOOKMARK [2][-]{subsection.6.2.3}{Trimming the Quotient}{section.6.2}
\BOOKMARK [2][-]{subsection.6.2.4}{Trimming the Residue}{section.6.2}
\BOOKMARK [2][-]{subsection.6.2.5}{The Barrett Algorithm}{section.6.2}
\BOOKMARK [2][-]{subsection.6.2.6}{The Barrett Setup Algorithm}{section.6.2}
\BOOKMARK [1][-]{section.6.3}{The Montgomery Reduction}{chapter.6}
\BOOKMARK [2][-]{subsection.6.3.1}{Digit Based Montgomery Reduction}{section.6.3}
\BOOKMARK [2][-]{subsection.6.3.2}{Baseline Montgomery Reduction}{section.6.3}
\BOOKMARK [2][-]{subsection.6.3.3}{Faster ``Comba'' Montgomery Reduction}{section.6.3}
\BOOKMARK [2][-]{subsection.6.3.4}{Montgomery Setup}{section.6.3}
\BOOKMARK [1][-]{section.6.4}{The Diminished Radix Algorithm}{chapter.6}
\BOOKMARK [2][-]{subsection.6.4.1}{Choice of Moduli}{section.6.4}
\BOOKMARK [2][-]{subsection.6.4.2}{Choice of k}{section.6.4}
\BOOKMARK [2][-]{subsection.6.4.3}{Restricted Diminished Radix Reduction}{section.6.4}
\BOOKMARK [2][-]{subsection.6.4.4}{Unrestricted Diminished Radix Reduction}{section.6.4}
\BOOKMARK [1][-]{section.6.5}{Algorithm Comparison}{chapter.6}
\BOOKMARK [0][-]{chapter.7}{Exponentiation}{}
\BOOKMARK [1][-]{section.7.1}{Exponentiation Basics}{chapter.7}
\BOOKMARK [2][-]{subsection.7.1.1}{Single Digit Exponentiation}{section.7.1}
\BOOKMARK [1][-]{section.7.2}{k-ary Exponentiation}{chapter.7}
\BOOKMARK [2][-]{subsection.7.2.1}{Optimal Values of k}{section.7.2}
\BOOKMARK [2][-]{subsection.7.2.2}{Sliding-Window Exponentiation}{section.7.2}
\BOOKMARK [1][-]{section.7.3}{Modular Exponentiation}{chapter.7}
\BOOKMARK [2][-]{subsection.7.3.1}{Barrett Modular Exponentiation}{section.7.3}
\BOOKMARK [1][-]{section.7.4}{Quick Power of Two}{chapter.7}
\BOOKMARK [0][-]{chapter.8}{Higher Level Algorithms}{}
\BOOKMARK [1][-]{section.8.1}{Integer Division with Remainder}{chapter.8}
\BOOKMARK [2][-]{subsection.8.1.1}{Quotient Estimation}{section.8.1}
\BOOKMARK [2][-]{subsection.8.1.2}{Normalized Integers}{section.8.1}
\BOOKMARK [2][-]{subsection.8.1.3}{Radix- Division with Remainder}{section.8.1}
\BOOKMARK [1][-]{section.8.2}{Single Digit Helpers}{chapter.8}
\BOOKMARK [2][-]{subsection.8.2.1}{Single Digit Addition and Subtraction}{section.8.2}
\BOOKMARK [2][-]{subsection.8.2.2}{Single Digit Multiplication}{section.8.2}
\BOOKMARK [2][-]{subsection.8.2.3}{Single Digit Division}{section.8.2}
\BOOKMARK [2][-]{subsection.8.2.4}{Single Digit Root Extraction}{section.8.2}
\BOOKMARK [1][-]{section.8.3}{Random Number Generation}{chapter.8}
\BOOKMARK [1][-]{section.8.4}{Formatted Representations}{chapter.8}
\BOOKMARK [2][-]{subsection.8.4.1}{Reading Radix-n Input}{section.8.4}
\BOOKMARK [2][-]{subsection.8.4.2}{Generating Radix-n Output}{section.8.4}
\BOOKMARK [0][-]{chapter.9}{Number Theoretic Algorithms}{}
\BOOKMARK [1][-]{section.9.1}{Greatest Common Divisor}{chapter.9}
\BOOKMARK [2][-]{subsection.9.1.1}{Complete Greatest Common Divisor}{section.9.1}
\BOOKMARK [1][-]{section.9.2}{Least Common Multiple}{chapter.9}
\BOOKMARK [1][-]{section.9.3}{Jacobi Symbol Computation}{chapter.9}
\BOOKMARK [2][-]{subsection.9.3.1}{Jacobi Symbol}{section.9.3}
\BOOKMARK [1][-]{section.9.4}{Modular Inverse}{chapter.9}
\BOOKMARK [2][-]{subsection.9.4.1}{General Case}{section.9.4}
\BOOKMARK [1][-]{section.9.5}{Primality Tests}{chapter.9}
\BOOKMARK [2][-]{subsection.9.5.1}{Trial Division}{section.9.5}
\BOOKMARK [2][-]{subsection.9.5.2}{The Fermat Test}{section.9.5}
\BOOKMARK [2][-]{subsection.9.5.3}{The Miller-Rabin Test}{section.9.5}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff