Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

A pure rust implementation of the post-quantum streamlined ntruprime algorithm authored by Bernstein, Chuengsatiansup, Lange and Christine van Vredendaal

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
License-Apache.md
MIT
License-MIT.md

mberry/Streamlined-NTRU-Prime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Streamlined NTRU Prime

Crates.io Build Status Crates.io dependency status

Update warning

This code is based on the first round submission and outdated. The C codebase has been widely refactored and multiple parameter sets are now available. This library is similar to the current second round sntrup761 submission.

Don't use this library in production.

Bringing it into line with the current NTRUPrime is an aspirational todo. Probably will wait until the NIST Post-Quantum competition is finished.


A rust implementation of Streamlined NTRU Prime 4591761

NTRU Prime is a lattice based cryptosystem aiming to improve the security of lattice schemes at minimal cost. It is thought to be resistant to quantum computing advances, in particular Shor's algorithm and is an entrant in NIST's Post Quantum Cryptography competition[1].

Please read the warnings before use.

The algorithm was authored by Daniel J. Bernstein, Chitchanok Chuengsatiansup, Tanja Lange & Christine van Vredendaal.

Contributions welcome. SIMD especially.

WASM functionality has not been pushed to crates yet and may never be given the library is outdated.

Parameter set:

  • p = 761
  • q = 4591
  • w = 286

Outputs:

Type Bytes
Public Key 1218
Private Key 1600
Ciphertext 1047
Shared Key 32

Installation

Add to your cargo.toml file

[dependencies]
streamlined_ntru_prime = "0.1.2"

Usage

use streamlined_ntru_prime::*;

// Key Generation
let (public_key, private_key) = generate_key();

// Encapsulation
let (cipher_text, encapsulated_shared_secret) = encapsulate(public_key);

// Decapsulation
let decapsulated_shared_secret = decapsulate(cipher_text, private_key).expect("Decapsulation failure");

assert_eq!(encapsulated_shared_secret, decapsulated_shared_secret);

Current Benchmarks

Tested on an Intel i7-7500U @ 2.7GHz

running 3 tests
test decapsulate_bench ... bench:   8,785,535 ns/iter (+/- 27,291)
test encapsulate_bench ... bench:   3,215,100 ns/iter (+/- 30,317)
test key_gen_bench     ... bench:  16,914,970 ns/iter (+/- 278,949)

Warnings

Implementation

This implementation has not undergone any security auditing and while care has been taken no guarantees can be made for either correctness or the constant time running of the underlying functions. Please use at your own risk.

Algorithm

Streamlined NTRU Prime was first published in 2016, the C implementation upon which this is based was published in August 2017. The algorithm still requires careful security review. Please see here for further warnings from the authors regarding NTRU Prime and lattice based encryption schemes.

About

A pure rust implementation of the post-quantum streamlined ntruprime algorithm authored by Bernstein, Chuengsatiansup, Lange and Christine van Vredendaal

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
License-Apache.md
MIT
License-MIT.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published