Giter Site home page Giter Site logo

abhi-agrawl / rsa-algorithm Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 15 KB

Implementing RSA Algorithm using MR Test, FME Test, EA and EEA

License: Apache License 2.0

Java 100.00%
rsa rsa-encryption rsa-algorithm rsa-cryptography rsa-key miller-rabin extended-euclidean-algorithm euclidean-algorithm

rsa-algorithm's Introduction

RSA Algorithm

  • Generating Key value pair with a multiple options for number of bits to choose from.
  • Option to store Public and Private Key in .txt file.
  • Encrypts a message (also gives option to import key stored by the same program)
  • Option to store Encrypted Message in .txt file.
  • Decrypts a message (also gives option to import key stored by the same program)

Implementation

I. Key Generation

Using CreateRandom Class

  • Get two different large prime numbers p and q
    • Using Miller-Rabin Test

Using GenerateKeys Class

  • Let n = p * q

  • Let φ(n) = (p-1) * (q-1)

  • Choose a small, odd integer number e, where 1 < e < φ(n) and e is a co-prime to φ(n).

    • Using Euclidean Algorithm
    • Check calculateEncryptionExponent() method
  • Calculate the integer number d, where ed ≡ 1 mod φ(n) and 1 < d < φ(n).

    • Using Extended Euclidean Algorithm
    • Check calculateDecryptionExponent() method
  • The public key of the RSA is the pair PK = (n, e)

  • The secret key of the RSA is the pair SK = (n, e)

II. Encryption

Using FME Class

  • To encrypt the message m (where m < n) using the public key PK = (n, e) following formula is used: (Fast Modular Exponent)

    c := EncPK(m) = m^e (mod n).
    

III. Decryption

Using FME Class

  • To decrypt the secret message c using the secret key d following formula is used: (Fast Modular Exponent)

    m := DecSK(c) = c^d (mod n).
    

rsa-algorithm's People

Contributors

abhi-agrawl avatar

Stargazers

 avatar

Watchers

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