No Description

David Hill 9e0f3af2f0 Update API (#6) 1 year ago
.github 9e0f3af2f0 Update API (#6) 1 year ago
examples 9e0f3af2f0 Update API (#6) 1 year ago
r3 f6d504b86d Various cleanups. (#1) 6 years ago
rq f6d504b86d Various cleanups. (#1) 6 years ago
testdata d12a55f2fc initial import 6 years ago
zx f6d504b86d Various cleanups. (#1) 6 years ago
.gitignore f6d504b86d Various cleanups. (#1) 6 years ago
LICENSE d12a55f2fc initial import 6 years ago
Makefile d12a55f2fc initial import 6 years ago
README.md 2b0d299dbd build: replace travis ci with cia via GitHub actions (#5) 3 years ago
go.mod 9e0f3af2f0 Update API (#6) 1 year ago
sntrup4591761.go 9e0f3af2f0 Update API (#6) 1 year ago
sntrup4591761_test.go 9e0f3af2f0 Update API (#6) 1 year ago
test.sh 2b0d299dbd build: replace travis ci with cia via GitHub actions (#5) 3 years ago

README.md

sntrup4591761

Build Status ISC License GoDoc

Streamlined NTRU Prime 4591^761

sntrup4591761 is a Go library implementing the Streamlined NTRU Prime 4591761 cryptosystem. Most of the code consists of a port of the reference C implementation.

Constants

  • PublicKeySize

The size of an encoded public key.

  • PrivateKeySize

The size of an encoded private key.

  • CiphertextSize

The size of a ciphertext encapsulating a shared key.

  • SharedKeySize

The size of a shared key.

Functions

  • GenerateKey(s io.Reader) (*[PublicKeySize]byte, *[PrivateKeySize]byte, error)

GenerateKey returns a new a public/private key pair with randomness from s. GenerateKey will fail if randomness cannot be obtained from s.

  • Encapsulate(s io.Reader, publicKey *[PublicKeySize]byte) (*[CiphertextSize]byte, *[SharedKeySize]byte, error)

Encapsulate generates a random shared key and encrypts it with the given public key. The shared key and its corresponding ciphertext are returned. Encapsulate will fail if randomness cannot be obtained from s.

  • Decapsulate(ciphertext *[CiphertextSize]byte, privateKey *[PrivateKeySize]byte) (*[SharedKeySize]byte, int)

Decapsulate uses a private key to decrypt a ciphertext, returning an encapsulated shared key. Decapsulate will return zero if the ciphertext is invalid.

Examples

The library is accompanied by three small standalone applications demonstrating its use: keygen, encap, and decap. A test script is provided to exercise these applications comprehensively.

To build the bundled applications, ensure that the repository lies in your GOPATH and run make. Once built, the auxiliary test script can be triggered by invoking ./test.

Sage tests

A set of 128 different instances of NTRU Prime were simulated in Sage and their data compiled in testdata/sage128.gz. The TestSage Go test contrasts the results obtained by the library with those from the Sage implementation. Please note that this test can take seconds to complete.

Running the tests

To run the Sage tests and other tests, ensure that the repository lies in your GOPATH and run go test -v.

License

sntrup4591761 is licensed under the copyfree ISC License.