In this code, no library used and everything done by standard functions of python. Simple and easy to understand.
This code reads plain text and key from text files.
This program was written by Shooresh Sufiye. you can copy and change it, But don't forget to mention the source.
# Written by: Shooresh Sufiye # f = open("plain.txt", "r") allplain = f.read() f.close() print ("plain text:\n ", allplain)
f = open("plain.txt", "rb+") kf = open ("key.txt", "rb" ) f2= open("cipher.txt", "r+")
allplain = f.read() key = key = kf.read() # - encrypt plain text and save into cipher.txt
for i in range(len(allplain)): k = chr (key[i]) p = chr (allplain[i]) c = chr ((ord(p)) ^ (ord(k))) f2.write(c)
This code is written in three section which you can divide and use each one separately.
1. Generating custom RSA keys.
2. Use Java "security" and "crypto" API to encrypt and decrypt the text.
2. Use keys produced by API and use my algorithm to encrypt and decrypt.
-This program is written by Shooresh Sufiye. Feel free to copy and change it, But don't forget to mention the source.