Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

abhi-agrawl/rsa-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /