What is LibTomMath?
LibTomMath is a free and open source multiple precision integer library written
entirely in portable ISO C. By portable it is meant that the library does not
contain any code that is computer platform dependent or otherwise problematic
to use on any given platform.
The library has been successfully tested under numerous operating systems
including Unix, MacOS, Windows, Linux, PalmOS and on standalone hardware
such as the Gameboy Advance. The library is designed to contain enough
functionality to be able to develop applications such as public key
cryptosystems and still maintain a relatively small footprint.
Goals of LibTomMath
Libraries which obtain the most eciency are rarely written in a high level
programming language such as C. However, even though this library is written
entirely in ISO C, considerable care has been taken to optimize the algorithm
implementations within the library. Specically the code has been written to
work well with the GNU C Compiler (GCC ) on both x86 and ARM processors.
Wherever possible, highly efficient algorithms, such as Karatsuba
multiplication, sliding window exponentiation and Montgomery reduction have been
provided
to make the library more efficient.
Even with the nearly optimal and specialized algorithms that have been in-
cluded the Application Programing Interface (API ) has been kept as simple
as possible. Often generic place holder routines will make use of specialized
algorithms automatically without the developers specific attention. One such
example is the generic multiplication algorithm mp_mul() which will automat-
ically use ToomCook, Karatsuba, Comba or baseline multiplication based on
the magnitude of the inputs and the conguration of the library.
Making LibTomMath as efficient as possible is not the only goal of the
LibTomMath project. Ideally the library should be source compatible with
another popular library which makes it more attractive for developers to use.
In this case the MPI library was used as a API template for all the basic func-
tions. MPI was chosen because it is another library that is in the same niche
as LibTomMath. Even though LibTomMath uses MPI as the template for the
function names and argument passing conventions, it has been written from
scratch by Tom St Denis.
The project is also meant to act as a learning tool for students, the logic
being that no easy-to-follow bignum library exists which can be used to teach
computer science students how to perform fast and reliable multiple precision
integer arithmetic. To this end the source code has been given quite a few
comments and algorithm discussion points.
| |