Advertisement
K-Metal

ASCII Encryption

May 25th, 2015
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. # Basic ASCII encryption in Python
  2. # By K-Metal
  3. # Feel free to use this in encrypted data sending
  4.  
  5. #Enter the string to encrpt
  6. word = raw_input("Enter phrase to encrypt: ")
  7.  
  8.  
  9.  
  10. #Starting Encryption
  11. step1 = word.encode('hex')
  12. c = 0
  13. step2 = ''
  14. while c < len(step1):
  15.     step2 += step1[c]
  16.     step2 += "/"
  17.     c += 1
  18. c = 0
  19. step3 = step2.encode('base64')
  20. step4 = ''
  21. while c < len(step3):
  22.     step4 += step3[c]
  23.     step4 += "."
  24.     c += 1
  25. c = 0
  26. step5 = ''
  27. while c < len(step4):
  28.     step5 += step4[c]
  29.     step5 += " "
  30.     c += 1
  31. f1 = step5.encode('uu')
  32. encrypted  =  f1.encode('hex')
  33. print "\nFinal Encryption: " + encrypted
  34.  
  35.  
  36. #Decrpyting the Message
  37. print "\nStarting Decryption..."
  38. s = encrypted.decode('hex')
  39. s1 = s.decode('uu')
  40. s2 = ''
  41. c = 0
  42. while c < len(s1.split(" ")):
  43.     s2 += s1.split(" ")[c]
  44.     c += 1
  45. c = 0
  46. s3 = ''
  47. while c < len(s2.split(".")):
  48.     s3 += s2.split(".")[c]
  49.     c += 1
  50. s4 = s3.decode('base64')
  51. c = 0
  52. s5 = ''
  53. while c < len(s4.split("/")):
  54.     s5 += s4.split("/")[c]
  55.     c += 1
  56. decrypted = s5.decode('hex')
  57. print "\nFinal is answer is : " + decrypted
  58.  
  59. #Made for Fun
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement