Post-Quantum Lattice-based Public Key Cryptography
NTRU is a lattice-based public key cryptosystem that's resistant to quantum computer attacks.
Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.
NTRU (N-th degree Truncated polynomial Ring Units) is one of the oldest and most studied post-quantum cryptographic algorithms, first proposed in 1996 by mathematicians Jeffrey Hoffstein, Jill Pipher, and Joseph H. Silverman.
Unlike RSA and ECC which can be broken by quantum computers using Shor's algorithm, NTRU's security is based on the hardness of the Shortest Vector Problem (SVP) in lattices - a problem believed to be resistant to quantum attacks.
| Algorithm | Type | Quantum Safe? | Status |
|---|---|---|---|
| RSA | Integer Factorization | Broken by Shor's | Migrate away |
| ECC / ECDSA | Discrete Log (Curves) | Broken by Shor's | Migrate away |
| NTRU | Lattice (SVP) | Quantum Resistant | Safe to use |
| CRYSTALS-Kyber | Lattice (MLWE) | Quantum Resistant | NIST Standard |
NTRU supports multiple parameter sets for different security/performance trade-offs:
From 2011 IEEE paper - recommended for most uses
APR2011_743_FAST - 256-bit security (recommended)APR2011_743 - 256-bit (non-optimized)APR2011_439_FAST - 128-bit securityAPR2011_439 - 128-bit (smaller keys)Standardized parameter sets
EES1499EP1 - 256-bit (highest security)EES1171EP1 - 192-bit securityEES1087EP2 - 112-bit security_FAST optimized variantsUses NTRU + X25519 hybrid key exchange by default since August 2022
CECPQ2 experiment tested NTRU for post-quantum TLS
Standardized in 2008 for lattice-based public-key cryptography
NIST's Post-Quantum Cryptography Standardization project evaluated algorithms resistant to quantum attacks:
| Algorithm | Type | NIST Status |
|---|---|---|
| CRYSTALS-Kyber | KEM (Lattice/MLWE) | Selected Standard |
| NTRU | KEM (Lattice/SVP) | Round 3 Finalist |
| NTRU Prime | KEM (Lattice) | Round 3 Alternate |
| CRYSTALS-Dilithium | Signature | Selected Standard |
While Kyber was selected as the primary KEM standard, NTRU remains widely deployed and is considered secure.
// Java - Using BouncyCastle NTRU
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
import org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec;
Security.addProvider(new BouncyCastlePQCProvider());
// Generate key pair
KeyPairGenerator kpg = KeyPairGenerator.getInstance("NTRU", "BCPQC");
kpg.initialize(NTRUParameterSpec.ntruhrss701);
KeyPair kp = kpg.generateKeyPair();
// Encrypt
Cipher cipher = Cipher.getInstance("NTRU", "BCPQC");
cipher.init(Cipher.ENCRYPT_MODE, kp.getPublic());
byte[] ciphertext = cipher.doFinal(plaintext);
# Python - Using ntru library
from ntru import NTRUEncrypt
# Initialize with parameter set
ntru = NTRUEncrypt(N=743, p=3, q=2048)
# Generate keys
public_key, private_key = ntru.generate_keypair()
# Encrypt message
ciphertext = ntru.encrypt(message, public_key)
# Decrypt message
plaintext = ntru.decrypt(ciphertext, private_key)
// C - Using libntru
#include "ntru.h"
// Generate key pair
NtruEncKeyPair kp;
NtruRandGen rng = NTRU_RNG_DEFAULT;
ntru_gen_key_pair(&NTRU_DEFAULT_PARAMS_128_BITS, &kp, &rng);
// Encrypt
uint8_t enc[NTRU_MAX_ENC_LEN];
uint16_t enc_len;
ntru_encrypt(msg, msg_len, &kp.pub, &NTRU_DEFAULT_PARAMS_128_BITS,
&rng, enc, &enc_len);
// Decrypt
uint8_t dec[NTRU_MAX_MSG_LEN];
uint16_t dec_len;
ntru_decrypt(enc, &kp, &NTRU_DEFAULT_PARAMS_128_BITS, dec, &dec_len);