Skip to content

DerJesko/regev_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packed Regev

A python implementation of the packed Regev encryption scheme.

The Regev encryption scheme is a additivly homomorphic, private key encryption scheme. It is secure under the LWE assumption (which likely is secure even against attacks from quantum computers).

The packed version of this scheme combines two modifications which improve ciphertext sizes.

Install Dependencies

To install all necessary dependencies run pip install -r requirements.txt

Usage

Here is how you encrypt with packed Regev

import numpy as np

# Generate the public parameters to use this scheme
sec_param = 256
mes_mod = 64
num_mes = 100
pp = RegevPublicParameters.for_pack(sec_param, 0, num_mes, mes_mod)
# Generate the key according to these parameters
k = RegevKey.gen(pp)
# The message you want to encrypt
mes = np.random.randint(mes_mod, size=num_mess)
# Encrypt the message using the batched Regev encryption
c = BatchedRegevCiphertext.encrypt_raw(pp, k, mes, mes_mod=mes_mod)
# Pack the ciphertext (convert to packed Regev)
cp = c.pack(pp)

You can then decrypt it via

cp.decrypt(pp,k)

You can serialize any object of this module via .to_bytes and deserialize via .from_bytes. The specific arguments for these methods are detailed in the documentation

Here should be a paragraph about the parameter choice

TODOs

  • fix correctness of packed regev
  • cli
  • easier parameter choice
  • serialization
    • keys
    • ciphertext
    • packed ciphertext
  • seeded randomness (smaller secret keys)
    • remove deprecation warning
  • speed improvements by implementing parts in Cython
    • serialization
    • randomness
  • addition for packed ciphertexts
  • unit testing framework
  • package things
  • example (federated learning)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages