Skip to content

Modified-RSA is a simple script written using using programming language for calculating the public key are private key for Modified-RSA.

Notifications You must be signed in to change notification settings

nishanthakur/Modified-RSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Modified RSA

RSA algorithm uses only two prime numbers to generate a public and private key. As an outcome, it remains vulnerable to prime factorization, cycling, and forward search attacks. Until today, RSA has maintained security by doubling the length of a public key whenever it gets cracked. The security of RSA can be easily compromised with the help of quantum computers. Thus, much research has been carried out and papers have been published for strengthening the RSA Algorithm. One of many is the Modified RSA Encryption Algorithm. After studying this paper, I have created two scripts namely rsa.py and modified_rsa.py for generating key-pairs using RSA and Modified RSA Algorithms respectively.

Usage of RSA Script

SAMPLE A: Encrypting and Decrypting message “123” using RSA.

Step 01: Selecting two large distinct random prime numbers i.e. [p=83 and q=89]

image

Step 02: Calculating n, n = p * q, n = 83 * 89, [n = 7387]

image

Step 03: Calculating ϕ(n) = (p-1) * (q-1), ϕ(n) = (83-1) * (89-1), [ϕ(n) = 7216]

image

Step 04: Selecting “e” in the range of 1 < e < ϕ(n) and gcd (e, ϕ(n)) = 1, [e = 97]

image

Step 05: Calculating “d” in the range of 1 < d <ϕ(n) and [e * d mod ϕ (n) = 1], [d = 5505]

image

Step 06: Selecting Plaintext “M”, [M = 123]

image

Step 07: Encryption, Cipher text; C = Me mod n, C = 12397 mod 7387, [C = 1369]

image

Step 08: Decryption, Plaintext; M = Cd mod n, P = 13695505 mod 7387, [P = 123]

image

Usage of Modified RSA

TEST: Encrypting / Decrypting Message “98526” using Modified – RSA Algorithm.

Step 01: Selecting three large distinct random prime numbers i.e. [p=83 and q=89 and r = 97]

image

Step 02: Calculating n, n = p * q * r, n = 83 * 89 * 97, [n =716539]

image

Step 03: Calculating z, z = n – 10, z= 716539 – 10, [z = 716529]

image

Step 04: Calculating ϕ(n) = (p-1) * (q-1) * (r-1), ϕ(n) = (83-1) * (89-1) * (r-1), [ϕ(n) = 692736]

image

Step 05: Selecting “e” in the range of 1 < e < ϕ(n) and gcd (e, ϕ(n)) = 1, [e = 101]

image

Step 06: Calculating “f”, f = (e * 2) + 1, f = (101 * 2) + 1, [f = 203]

image

Step 07: Calculating “d” in the range of 1 < d <ϕ(n) and [e * d mod ϕ (n) = 1], [d =150893]

image

Step 08: Selecting Plaintext “M”, [M = 98526]

image

Step 09: Encryption, Cipher text; C = M(f-1)/2 mod (z+10), C = 98526(203-1)/2 mod 716539, [C = 637929]

image

Step 10: Decryption, Plaintext; M = Cd mod (z+10), P = 637929150893 mod 716539, [P = 98526]

image

Note: In the above samples, we have generated key pairs and used them to encrypt and decrypt messages that are in numeric form. These messages in the numeric form are obtained after performing ASCII to numeric conversion.

About

Modified-RSA is a simple script written using using programming language for calculating the public key are private key for Modified-RSA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages