MY CODE >> RSA Encrytion & Decryption
# Tommy Martin
# 
# This is the RSA Public Key that will be used to encrypt documents
# 
# RSA Public Key.py

filename = "C:\Python27\Code\Example.txt"
writeto = "C:\Python27\Code\EncryptedMessage.txt"

target = open(writeto, 'w')
target.truncate()

txt = open(filename)
x = txt.read()

print "Here's you file %r" %filename
print

L = list(ord(c) for c in x)
Encryptor = []

# Thank you http://stackoverflow.com/questions/8452961/convert-string-to-ascii-value-python
for item in L:
    Encryptor.insert(len(Encryptor), pow(item, 3) % 3127)

for item in Encryptor:
    target.write("%s" % item)
    target.write("\n")

print "File encrypted successfully."


target.close()
txt.close()
# Tommy Martin
# 
# This is the RSA Private Key that will be used to decrypt documents
# 
# RSA Private Key.py

writeto = "C:\Python27\Code\EncryptedMessage.txt"
decode = "C:\Python27\Code\DecodedMessage.txt"

encoded = open(writeto)
decoded = open(decode, 'w')

print "Here's your file to be decrypted:\n %r" % writeto
print

message = [line.strip() for line in encoded]

decryptor = []

for item in message:
    decryptor.insert(len(decryptor), long(pow(int(item), 2011) % 3127))

endresult = ''.join(chr(i) for i in decryptor)

print "This is your decrypted message:\n"
print endresult
decoded.write(endresult)
print "\nThis text has also been printed to a .txt file called DecodedMessage.txt."

encoded.close()
decoded.close()