Swiftpack.co - libtom/libtommath as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by libtom.
libtom/libtommath v1.2.0
LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.
⭐️ 514
🕓 23 weeks ago
iOS macOS tvOS
.package(url: "https://github.com/libtom/libtommath.git", from: "v1.2.0")


This is the git repository for LibTomMath, a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C.

Build Status

Travis CI

master: Build Status

develop: Build Status


master: Build status

develop: Build status

ABI Laboratory

API/ABI changes: check here


The develop branch contains the in-development version. Stable releases are tagged.

Documentation is built from the LaTeX file bn.tex. There is also limited documentation in tommath.h. There is also a document, tommath.pdf, which describes the goals of the project and many of the algorithms used.

The project can be build by using make. Along with the usual make, make clean and make install, there are several other build targets, see the makefile for details. There are also makefiles for certain specific platforms.


Tests are located in demo/ and can be built in two flavors.

  • make test creates a stand-alone test binary that executes several test routines.
  • make mtest_opponent creates a test binary that is intended to be run against mtest. mtest can be built with make mtest and test execution is done like ./mtest/mtest | ./mtest_opponent. mtest is creating test vectors using an alternative MPI library and test is consuming these vectors to verify correct behavior of ltm

Building and Installing

Building is straightforward for GNU Linux only, the section "Building LibTomMath" in the documentation in doc/bn.pdf has the details.

CMake support

The project provides support for the CMake build system.

git clone https://github.com/libtom/libtommath.git
mkdir -p libtommath/build
cd libtommath/build
cmake ..
make -j$(nproc)

A shared library build can be done by setting -DBUILD_SHARED_LIBS=On when invoking the cmake command.


Stars: 514
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics