#encryption #module #scheme #public-key #decryption #encryption-decryption #key-gen

bin+lib module-lwe

Implements the module learning-with-errors public key encrpytion scheme

1 unstable release

0.1.0 Jan 31, 2025

#2004 in Cryptography

Download history 79/week @ 2025-01-26 38/week @ 2025-02-02

117 downloads per month

MIT and AGPL-3.0-or-later

22KB
392 lines

module-LWE

example workflow License: MIT

Implmentation of lattice-based encryption method ring-LWE in pure Rust.

Description: This provides the basic PKE (keygen, encryption, and decryption) operations for the ring learning-with-errors and module learning-with-errors scheme.

Disclaimer: This is not secure. It is not written in constant-time nor resistant to other side-channel attacks. This is intended for educational use and not for real-world applications.

See: open-encrypt

Usage: In the src directory,

cargo build

To build the binary.

cargo test

  • Performs keygen/encrypt/decrypt for a test message.
  • Checks homomorphic addition and multiplcation hold for small values.

Note: Parameters optional via

  • --params <n> <q> <k>

where n is polynomial degree, q is modulus, k is the module rank.

If ommitted, the default parameters will be used.

cargo run -- keygen

This will generate a public/secret keypair.

cargo run -- encrypt <public_key> <message>

Generates the ciphertext.

cargo run -- decrypt <secret_key> <ciphertext>

Decrypts the ciphertext given a secret key, printing the plaintext message.

Dependencies

~3MB
~61K SLoC