This repository creates an application that combines the lattice-based encryption algorithm and a customized Vigenère cipher algorithm and use this algorithm to protect the network writer from content leak. Lattice-based encryption, which is considered to be safe in quantum computing era, is used to encrypt the key and code table that are used by the customized Vigenère cipher, which can only contain common characters without messy code. Using this encryption can make the encrypted article version-tracking friendly, so that the cloud storage can store the text version changes, which provide a revision history for the writer.
- Python 3.8 or higher version
- pip 22 or higher version
please install the packages with
pip install -r requirements.txtrequirements.txt resides in the working directory
Folder data contains:
- the whole CJK character dataset
- sensitive keyword dataset [Sensitive_***.txt]
An implementation of lattice-based encryption
config.yaml, which is a yaml configuration file, contains metadata lists. Adding or removing items in the lists can change the metadata.
CAUTION: Lattice-based encryption/decryption takes a long-running time (10+ minutes for encryption, 16+ minutes for decryption) on every file, please be patient. Or you can remove the test case from the config.yaml file, then the related test cases will skip. Strongly recommend that only try one test case with NTRY lattice-based encryption.
First, please clone or download the project. Then:
python main.pyDue to the long-running time of Lattice-based encryption/decryption by NTRU, setting the code to debug mode can skip the lattice-based encryption, which can save a lot of testing time. In the configuration file config.yaml, set the global config item IsDebug: True can skip the Lattice-based encryption/decryption.
The embedded test cases are:
- Simple Text Encryption and Decryption
- Long Text Encryption and Decryption
- Japanese Article Encryption and Decryption
python main.pyDue to very limited development time, this project only provides a very limited option to run, which is run all embedded test cases. But changing the files:
- LongTextWithKeywords.txt
- JapaneseArticle.txt
- SimpleText.txt
in data/ folder can make the program run with different articles.
Many thanks NTRU_Python https://github.com/pointedsphere/NTRU_python