Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Basic ASCII encryption in Python
- # By K-Metal
- # Feel free to use this in encrypted data sending
- #Enter the string to encrpt
- word = raw_input("Enter phrase to encrypt: ")
- #Starting Encryption
- step1 = word.encode('hex')
- c = 0
- step2 = ''
- while c < len(step1):
- step2 += step1[c]
- step2 += "/"
- c += 1
- c = 0
- step3 = step2.encode('base64')
- step4 = ''
- while c < len(step3):
- step4 += step3[c]
- step4 += "."
- c += 1
- c = 0
- step5 = ''
- while c < len(step4):
- step5 += step4[c]
- step5 += " "
- c += 1
- f1 = step5.encode('uu')
- encrypted = f1.encode('hex')
- print "\nFinal Encryption: " + encrypted
- #Decrpyting the Message
- print "\nStarting Decryption..."
- s = encrypted.decode('hex')
- s1 = s.decode('uu')
- s2 = ''
- c = 0
- while c < len(s1.split(" ")):
- s2 += s1.split(" ")[c]
- c += 1
- c = 0
- s3 = ''
- while c < len(s2.split(".")):
- s3 += s2.split(".")[c]
- c += 1
- s4 = s3.decode('base64')
- c = 0
- s5 = ''
- while c < len(s4.split("/")):
- s5 += s4.split("/")[c]
- c += 1
- decrypted = s5.decode('hex')
- print "\nFinal is answer is : " + decrypted
- #Made for Fun
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement