Skip to content

Instantly share code, notes, and snippets.

View itzceekay's full-sized avatar
🏁

Kirubanand Chandrasekarn itzceekay

🏁
View GitHub Profile
@itzceekay
itzceekay / RSA_example.py
Created April 19, 2018 15:37 — forked from syedrakib/RSA_example.py
An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library
# Inspired from http://coding4streetcred.com/blog/post/Asymmetric-Encryption-Revisited-(in-PyCrypto)
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/
from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys():
# RSA modulus length must be a multiple of 256 and >= 1024
modulus_length = 256*4 # use larger value in production