This project builds an asymmetric neural network system with homomorphic operations. It is build on the project Neural Cryptography and Keras Neural Arithmatic and Logical Unit (NALU).
The system consists of five neural networks: Alice, Bob, Eve, and two Homomorphic Operation (HO) networks, the HO Addition network and the HO Multiplication network. An elliptic curve key pair is generated, and Alice will use the public key to decrypt two plaintexts with a nonce for probabilistic encryption. The HO Addition network will add, while the HO Multiplication network will multiply the two ciphertexts. Bob will decrypt the ciphertext produced by the HO networks using the private key, while Eve will attempt to decrypt the ciphertext without the private key. In addition, Bob can decrypt ciphertexts directly from Alice, while Eve is not.
.
|–– ciphertext
|–– generate_ciphertext.py
|–– data_utils
|–– accuracy.py
|–– analyse_cipher.py
|–– dataset_generator.py
|–– plot_loss.py
|–– sequential_arithmetic_operations.py
|–– dataset
|–– figures
|–– key
|–– EllipticCurve.py
|–– neural_network
|–– nac.py
|–– nalu.py
|–– networks.py
|–– plaintext
|–– generate_plaintext.py
|–– weights
|–– requirements.txt
|–– results.py
|–– training.py
Require python version 3.9.13
and pip
- Clone the repository:
git clone https://github.com/minawoien/master-thesis.git
- Install dependencies:
pip install -r requirements.txt
Train the neural network and select preferable parameters using optional arguments:
-h, --help show this help message and exit
-rate RATE Dropout rate
-epoch EPOCH Number of epochs
-batch BATCH Batch size
-curve CURVE Elliptic curve name
python training.py
Weights will be saved during training in the weights
folder, where the weights from the experiments in this study is saved. Additionally, plaintexts, keys and ciphertexts from this study is generated and are located in their respectively folder.
To view the results:
python results.py
The results will be outputted in the console and figures will be saved in the figures
folder.
Optional arguments:
-h, --help show this help message and exit
-batch BATCH Batch size
python plaintext/generate_plaintext.py
Optional arguments:
-h, --help show this help message and exit
-batch BATCH Batch size
-curve CURVE Elliptic curve name
python key/EllipticCurve.py
Optional arguments:
-h, --help show this help message and exit
-batch BATCH Batch size
python -m ciphertext.generate_ciphertext