Advertisement
Guest User

Leet Convertor, 1337 [()|\|V3r+()r

a guest
Aug 22nd, 2014
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. # 1337 translator
  2. # Take a string and convert it into 1337
  3. # Code by Paul Spooner
  4. # Released to the public domain
  5.  
  6. from random import choice
  7.  
  8. #Uber leet?
  9. #0 to use some normal characters
  10. #1 for all |337 ones
  11. UL = 0
  12.  
  13. leetChars = {}
  14. leetChars["o"] = ("O","0","()","*")
  15. leetChars["i"] = ("I","1","!","|")
  16. leetChars["z"] = ("Z","2",)
  17. leetChars["e"] = ("E","3",)
  18. leetChars["a"] = ("A","4","^","@")
  19. leetChars["s"] = ("S","5","z","$")
  20. leetChars["q"] = ("Q","6","9")
  21. leetChars["d"] = ("D","6",)
  22. leetChars["t"] = ("T","7","+",)
  23. leetChars["b"] = ("B","8","6","&",)
  24. leetChars["p"] = ("P","9","?")
  25. leetChars["w"] = ("W",r"\/\/",)
  26. leetChars["x"] = ("X",r"><",)
  27. leetChars["h"] = ("H","|-|",)
  28. leetChars["n"] = ("N",r"|\|",)
  29. leetChars["c"] = ("C","[","(",)
  30. leetChars["k"] = ("K","X",r"|<",)
  31. leetChars["v"] = ("V",r"\/",)
  32. leetChars["m"] = ("M",r"|\/|","^^",)
  33. leetChars["l"] = ("L","|","|_",)
  34. leetChars["f"] = ("F","|=",)
  35. leetChars["y"] = ("Y","7","J")
  36. leetChars["u"] = ("U","|_|","O")
  37. leetChars["g"] = ("G","9",)
  38. leetChars["j"] = ("J","5","!")
  39.  
  40.  
  41.  
  42. def leet(s):
  43.     old_string = s.lower()
  44.     old_words = old_string.split()
  45.     new_words = []
  46.     for word in old_words:
  47.         for char, leetz in leetChars.items():
  48.             leetchoice = choice(leetz[UL:])
  49.             word = word.replace(char, leetchoice)
  50.         new_words += [word]
  51.     new_string = " ".join(new_words)
  52.     print(new_string)
  53.     #return new_string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement