Skip to Content
oxcrypto

Streamlined NTRU Prime

NTRU Prime KEM, including sntrup761 as used by OpenSSH.

from oxcrypto.kem.sntrup_kem import SNTRUP

private_key = SNTRUP.SNTRUP761.generate()
ciphertext, shared_secret = private_key.public_key().encapsulate()
assert private_key.decapsulate(ciphertext) == shared_secret
VariantPrivate keyPublic keyCiphertextShared secret
SNTRUP6531518 bytes994 bytes897 bytes32 bytes
SNTRUP7611763 bytes1158 bytes1039 bytes32 bytes
SNTRUP8571999 bytes1322 bytes1184 bytes32 bytes
SNTRUP9532254 bytes1505 bytes1349 bytes32 bytes
SNTRUP10132417 bytes1623 bytes1455 bytes32 bytes
SNTRUP12773059 bytes2067 bytes1847 bytes32 bytes

Private keys serialize in the full NTRU Prime secret-key encoding.

Warning

Experimental. Streamlined NTRU Prime is specified by draft-josefsson-ntruprime-streamlined, an Internet-Draft. sntrup761 is used in OpenSSH's sntrup761x25519-sha512 key exchange.

  • Crate: RustCrypto sntrup-kem 0.1.0-rc.0, pre-release, no published audit. Builds with Rust 1.88.
  • Vectors: draft-josefsson-ntruprime-streamlined-00 sntrup761 KATs, from the crate's tests/data. The other parameter sets have no bundled vectors and are covered by round-trip tests.

Zeroization

Retained state: the secret-key bytes. The upstream DecapsulationKey wipes them on drop.

Short-lived copies not wiped by the upstream crate: decapsulation intermediates and the shared-secret array the kem trait adapter returns before oxcrypto copies it into a wiped buffer.

On this page