LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
LibTomCrypt has been designed from the ground up to be very simple to use. It has a modular and standard API that allows new ciphers, hashes and PRNGs to be added or removed without change to the overall end application. It features easy to use functions and a complete user manual which has many source snippet examples.
LibTomCrypt is free for all purposes under the public domain. This includes commercial use, redistribution and even branching.
Supports the following:
- Public domain and open source.
- Written entirely in portable ISO C source (except for things like RNGs for natural reasons)
- Builds out of the box on virtually every box. All that is required is GCC for the source to build.
- Includes a 180+ page user manual in PDF format (with working examples in it)
- Block Ciphers
- Ciphers come with an ECB encrypt/decrypt, setkey and self-test interfaces.
- All ciphers have the same prototype which facilitates using multiple ciphers at runtime.
- Some of the ciphers are flexible in terms of code size and memory usage.
- Ciphers Supported:
- AES (aka Rijndael)
- Anubis (with optional tweak as proposed by the developers)
- Blowfish
- CAST5
- Camellia
- DES, two-key 3DES, 3DES
- KASUMI
- Khazad
- Multi2
- Noekeon
- RC2
- RC5
- RC6
- SAFER (K64, SK64, K128, SK128)
- SAFER+
- SEED
- Skipjack
- Twofish
- XTEA
- Stream Ciphers
- Stream ciphers come with setup, opt. set IV, crypt, done and self-test interfaces.
- ChaCha
- RC4
- SOBER-128
- All stream ciphers also come with a keystream interface which acts as if crypting with 0-bytes.
- Stream ciphers come with setup, opt. set IV, crypt, done and self-test interfaces.
- Chaining Modes
- Modes come with a start, encrypt/decrypt and set/get IV interfaces.
- Modes supported:
- CBC
- CFB
- CTR
- ECB
- F8 Chaining Mode
- LRW mode (IEEE)
- OFB
- XTS
- One-Way Hash Functions
- Hashes come with init, process, done and self-test interfaces.
- All hashes use the same prototypes for the interfaces.
- Hashes supported:
- Blake2b (160/256/384/512)
- Blake2s (128/160/224/256)
- MD2
- MD4
- MD5
- RIPE-MD (128/160/256/320)
- SHA-1
- SHA-2 (224/256/384/512/512-224/512-256)
- SHA-3 (224/256/384/512)
- SHA-3-SHAKE
- TIGER-192
- WHIRLPOOL
- Message Authentication
- Blake2b MAC
- Blake2s MAC
- CMAC, also known as OMAC1 (supports all ciphers)
- F9 MAC
- HMAC (FIPS-198, supports all hashes)
- PMAC Authentication
- Pelican MAC
- Poly1305 MAC
- XCBC MAC
- Message Encrypt+Authenticate Modes
- CCM Mode (NIST spec)
- ChaCha20-Poly1305 (IETF spec RFC7539)
- EAX Mode
- GCM Mode (IEEE spec)
- OCB Mode v1
- OCB Mode v3 (IETF spec RFC7253)
- Pseudo-Random Number Generators
- ChaCha20
- Fortuna
- RC4
- SOBER-128
- Yarrow
- Support for /dev/random, /dev/urandom and the Win32 CSP RNG
- Public Key Algorithms
- RSA (via PKCS #1)
- ECC (EC-DSA X9.62 signatures, X9.63 EC-DH)
- With fast Fixed Point ECC support as well
- X9.63 uncompressed import/export of public keys
- DSA
- Diffie-Hellman
- The math routines are pluggable which means you can use your own math provider if you want.
The library has support built in for:
- LibTomMath
- TomsFastMath
- GMP (GNU Multi Precision Arithmetic Library)
- Other standards
- PKCS #1 (v1.5 EMSA&EME and v2.0/v2.1 OAEP&PSS)
- PKCS #5 (PBKDF1, OpenSSL-compatible PBKDF1 and PBKDF2)
- ASN.1 DER for BOOLEAN, INTEGER, BIT STRING, OCTET STRING, NULL, SEQUENCE, SET, SET OF, CHOICE,
OBJECT IDENTIFIER, IA5 STRING, PRINTABLE STRING, TELETEX STRING, UTCTIME and GENERALIZED TIME types.
Support to detect CONSTRUCTED or CONTEXT SPECIFIC types is also provided. - Base64 and Base64-URL (RFC4648)
- HKDF (RFC5869)
- Checksum algorithms
- Adler32
- CRC-32
- Portable code builds out of the box with a conforming C compiler
- Builds out of the box for i686, x86_64, ppc32, ppc64, arm, aarch64, s390, s390x, SPARC, SPARC64, Altera NIOS2, Xilinx Microblaze, …
- Includes some platform optimizations for i386, x86_64 and ppc32.
LibTomCrypt builds out of the box with GCC >2.95, clang, mingw-gcc (32- and 64-bit), cygwin-gcc, HP cc, IBM xlc as well as Visual C++ >v6.00-SP5. It can be reconfigured to eliminate algorithms, use different build options (e.g. smaller or faster code) or use different build tools. It has been successfully tested on numerous platforms.