Created
April 30, 2013 01:55
-
-
Save tristanwietsma/5486172 to your computer and use it in GitHub Desktop.
Public-Private key encryption example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rsa | |
(pubkey, privkey) = rsa.newkeys(512, poolsize=8) | |
print pubkey | |
print privkey | |
msg = "this is a secret message!" | |
sec = rsa.encrypt(msg, pubkey) | |
print sec | |
dec = rsa.decrypt(sec, privkey) | |
print dec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment