Skip to content

This program contains socket programming where communication between client and server is end-to-end encrypted by El-Gamal public-key encryption scheme.

License

Notifications You must be signed in to change notification settings

ritu-thombre99/El-Gamal-and-RSA-scheme-with-Socket-Programming

Repository files navigation

El-Gamal and RSA Schemes implemented with-Socket-Programming

This program contains socket programming where communication between client and server is end-to-end encrypted by

    1. El-Gamal public-key encryption scheme
    1. RSA public-key encryption scheme

File el_gamal.py contains functions required for El-Gamal encryption scheme : get_primitive_root,key generation, encryption, decryption and some auxiliary functions to used in formatting input and output to encryption/decryption functions.

File rsa.py contains functions required for RSA encryption scheme : key generation, encryption, decryption and some auxiliary functions to used in formatting input and output to encryption/decryption functions.

client.ipynb and server.ipynb contain client side and server side code respectively. To choose encryption scheme for communication, remove comment in import section for that correspending file (el_gamal.py or rsa.py)

File 'El-Gamal Crypto-scheme.ipynb' is for demonstrating how El-Gamal works. File 'RSA.ipynb' is for demonstrating how RSA works.

Prime number of 84 bits (25 digits) is used. gmpy2 was used to perform modular operations on large numbers.

To install gmpy2 - https://anaconda.org/conda-forge/gmpy2

Download pyecm.py from https://github.com/martingkelly/pyecm which was used for finding prime factors of large numbers in a very less time.