Skip to content

Master thesis, Asymmetric Neural Cryptography with Homomorphic Properties

Notifications You must be signed in to change notification settings

minawoien/master-thesis

Repository files navigation

Asymmetric Neural Cryptography with Homomorphic and Probabilistic Properties

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).

Table of Contents

System

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.

Cryptosystem

Folder structure

.
|–– 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

Requirements

Require python version 3.9.13 and pip

Installation

  1. Clone the repository:
    git clone https://github.com/minawoien/master-thesis.git
  1. Install dependencies:
    pip install -r requirements.txt

Usage

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

Results

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.

Generate new plaintexts, keys and ciphertexts

Generate plaintext

Optional arguments:

-h, --help    show this help message and exit
-batch BATCH  Batch size
    python plaintext/generate_plaintext.py

Generate key pair

Optional arguments:

-h, --help    show this help message and exit
-batch BATCH  Batch size
-curve CURVE  Elliptic curve name
    python key/EllipticCurve.py

Generate ciphertexts

Optional arguments:

-h, --help    show this help message and exit
-batch BATCH  Batch size
    python -m ciphertext.generate_ciphertext

About

Master thesis, Asymmetric Neural Cryptography with Homomorphic Properties

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages