Git Product home page Git Product logo

simplersa's Introduction

SimpleRSA

This program is a class model for generating a simple public-key encryption using the RSA model The algorithm uses Karatsuba's algorithm for multiplying two big integers in O(n^1.585) runtime as opposed to the naive method of O(n^2) multiplication.

Multiplying big integers guarantes producing secure public-key and private-key

The program then produces individual integers in the range [limit, 2*limit] to make up the modulus of the public-key

The private-key is generted using Euclidean's Greatest Common Divisor method.

The class also contains a method to generate primes using the Sieve of Atkins algorithm. Since for now we only use two randomly chosen large integers, this algorithm is not used to generate the modulus of the public-key

To test it , create an object of type SimpleRSA and give it a paramter specifying the size of integers that make the modulus of your public key. If nothing is specified, the program usses Python 3.2x sys.maxsize to initliaze limit. Hence, the resulting public-key, private-key are big numbers,

Then call the method Python compute() on that object

Following are some examples:

>>> import SimpleRSA
>>> enc =SimpleRSA.SimpleRSA(23)
>>> enc.compute()
public key (1472, 29)
private key (1472, 914)

>>> import SimpleRSA
>>> enc =SimpleRSA.SimpleRSA(1000000)
>>> enc.compute()
public key (2104893971370, 308193614463)
private key (2104893971370, 699515598545)


>>> enc =SimpleRSA.SimpleRSA() 
>>> enc.compute()
public key (10468427810168432640, 9554926832143394029)
private key (10468427810168432640, 15581655766859127013)

Notice that, in the third example, we do not supply an upper bound for indiividual integers that make the public and private key. In this case, the program simply uses Python sys.maxsize which is equal to 2147483647

simplersa's People

Watchers

James Cloos 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.