Giter Club home page Giter Club logo

elgamal's Introduction

elgamal

Overview: elgamal is a python module that lets you encrypt and decrypt text using the ElGamal Cryptosystem.

Intended Use: This program was created as an exercise in cryptography in one of my classes at the University of Kentucky. I later turned it into a module. I do not recommend you use it to protect any sensitive information.

Using elgamal: Install elgamal by downloading elgamal.py and placing it in your module search path.

If you don't know your module search path, fire up a python console and run

import sys
sys.path

To use do

import elgamal

To generate a public/private key pair do

elgamal.generate_keys()
#returns a dictionary {'privateKey': privateKeyObject, 'publicKey': publicKeyObject}

By default generate_keys() generates a key of 256 bits with probability 0.9999999997671694 (1-(2^-32)) that your key is prime. You can alter the bitness of your keys and the certainty that your key is prime by passing arguments n and t like this.

elgamal.generate_keys(n, t)

where n is the number of bits you want your key to have and t means the probability that the key is prime is 1-(2^-t).

To encrypt a message do

cipher = elgamal.encrypt(publicKey, "This is the message I want to encrypt")
#returns a string

To decrypt the cipher text do

plaintext = elgamal.decrypt(privateKey, cipher)
#returns the message passed to elgamal.encrypt()

Compatibility: Python 3.4. Does not work in python 2.7!

License: MIT

Like this module? Tell me what you like about it here https://goo.gl/forms/nA8gBcjPiwAoWzg32

elgamal's People

Contributors

ryanriddle avatar vincentdavis avatar weikengchen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.