Create key-pair-generator.py

Create description.md

Create requirements.txt

Rename description.md to README.md

Update requirements.txt

Update README.md
This commit is contained in:
obiwan69 2019-10-15 22:45:32 +05:30 committed by Aditya Parikh
parent fa307e01a0
commit ab66a7a474
4 changed files with 43 additions and 0 deletions

View File

@ -71,6 +71,7 @@ So far, the following projects have been integrated to this repo:
|[IMDB TV Series Info Extractor](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/imdb_episode_ratings)|[Yash Raj Sarrof](https://github.com/yashYRS) | |[IMDB TV Series Info Extractor](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/imdb_episode_ratings)|[Yash Raj Sarrof](https://github.com/yashYRS) |
|[Yoda-speak Translator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/speak_like_yoda)|[sonniki](https://github.com/sonniki) | |[Yoda-speak Translator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/speak_like_yoda)|[sonniki](https://github.com/sonniki) |
|[Medium Article Downloader](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/medium_article_downloader)|[coolsonu39](https://github.com/coolsonu39)| |[Medium Article Downloader](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/medium_article_downloader)|[coolsonu39](https://github.com/coolsonu39)|
|[RSA Key Pair Generator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/RSA-key-pairs) | [Aditya Parikh](https://github.com/obiwan69) |
## How to use : ## How to use :

21
RSA-key-pairs/README.md Normal file
View File

@ -0,0 +1,21 @@
# Python RSA Key Pair Generator
This python script will generate a private and public key pair using the RSA algorithm
## Modules used
Math
```
import math
```
Random
```
import random
```
#Usage
You can use the public and private key to encrypt and decrypt information
Run the python file and get key pairs or edit the code and define your custom bounds in the random limits
```
random.randint(start,end)
```

View File

@ -0,0 +1,20 @@
#a simple RSA public key and private key pair generator
#using gcd from math module for coprimes
#and random for random numbers
import math
import random
p = random.randint(1,100)
q = random.randint(100,200)
if (math.gcd(p,q) == 1):
n = p * q
phi = (p-1)*(q-1)
k = 0
e = random.randint(1,20000)
if (math.gcd(phi,e)==1):
for i in range(1,20000):
d = (((phi * i) + 1)/e)
if d.is_integer():
k = d
break
print('Public key is: (',e,',',n,')')
print('Private key is: (',int(k),',',n,')')

View File

@ -0,0 +1 @@