daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main_char_lower = {"a": "b","c": "d","e": "f","g": "h","i": "j","k": "l","m": "n","o": "p","q": "r","s": "t","u": "v","w": "x","y": "z"}
  2. for key,value in main_char_lower.items(): main_char_lower[value] = key
  3. main_char_upper = dict()
  4. for key,value in main_char_lower.items(): main_char_upper[key.upper()] = value.upper()
  5. main_char_d_lower = dict()
  6. for key,value in main_char_lower.items(): main_char_d_lower[value] = key
  7. main_char_d_upper = dict()
  8. for key,value in main_char_upper.items(): main_char_d_upper[value] = key
  9. main_char_num = {"0": "1", "2": "3", "4": "5", "6": "7", "8": "9"}
  10. for key,value in main_char_num.items(): main_char_num[value] = key
  11. main_char_num_d = {}
  12. for key,value in main_char_num.items(): main_char_num_d[value] = key
  13. def encode(string, delx="g"):
  14.     el = list("aiueo")
  15.     for let in el:
  16.         string = string.replace(let, let+delx+let)
  17.     for let in el:
  18.                 let = let.upper()
  19.                 string = string.replace(let, let+delx+let)
  20.         string = list(string)
  21.         cursor = 0
  22.         for l in string:
  23.                 if l in main_char_lower:
  24.                         string[cursor] = main_char_lower[l]
  25.                 cursor += 1
  26.         cursor = 0
  27.         for l in string:
  28.                 if l in main_char_upper:
  29.                         string[cursor] = main_char_upper[l]
  30.                 cursor += 1
  31.         cursor = 0
  32.         for l in string:
  33.                 if l in main_char_num:
  34.                         string[cursor] = main_char_num[l]
  35.                 cursor += 1
  36.         string = ''.join(string)
  37.     return string
  38. def decode(string, delz="g"):
  39.         string = list(string)
  40.         cursor = 0
  41.         for l in string:
  42.                 if l in main_char_d_lower:
  43.                         string[cursor] = main_char_d_lower[l]
  44.                 cursor += 1
  45.         cursor = 0
  46.         for l in string:
  47.                 if l in main_char_d_upper:
  48.                         string[cursor] = main_char_d_upper[l]
  49.                 cursor += 1
  50.         cursor = 0
  51.         for l in string:
  52.                 if l in main_char_num_d:
  53.                         string[cursor] = main_char_num_d[l]
  54.                 cursor += 1
  55.         string = ''.join(string)
  56.     el = list("aiueo")
  57.     for let in el:
  58.                 string = string.replace(let+delz+let, let)
  59.     for let in el:
  60.                 let = let.upper()
  61.                 string = string.replace(let+delz+let, let)
  62.     return string
RAW Paste Data
Top