Advertisement
Jhynjhiruu

Encode from array

Mar 31st, 2018
677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.82 KB | None | 0 0
  1. import base64
  2. import ast
  3. import datetime
  4.  
  5. dec_input = input("Please paste a decoded Phoenotopia 1 passcode here:\n")
  6.  
  7. dec_data = ast.literal_eval(dec_input)
  8.  
  9. def _GameDataArrayToString(param1):
  10.     _loc3_ = str(param1[0]) + "," + str(param1[1]) + "," + str(param1[2]) + "," + str(param1[3]) + "," + str(param1[4]) + "," + str(param1[5]) + "," + str(param1[6]) + "," + str(param1[7]) + "," + str((_StringifyNumArray(param1[8][0]) + _StringifyNumArray(param1[8][1]) + _StringifyNumArray(param1[8][2]))) + "," + str(_StringifyBooleanArray(param1[9])) + "," + str(_StringifyKeyArray(param1[10])) + "," + str(param1[11]) + "," + str(param1[12]) + "," + str(param1[13]) + "," + str(param1[14]) + "," + str(param1[15]) + "," + str(param1[16]) + "," + str(param1[17]) + "," + str(param1[18]) + "," + str(param1[19]) + "," + str(param1[20]) + "," + str(param1[21]) + "," + str(param1[22]) + "," + str(param1[23]) + "," + str(param1[24]) + "," + str(param1[25]) + "," + str(param1[26]) + "," + str(param1[27]) + "," + str(param1[28]) + "," + str(param1[29]) + "," + str(param1[30]) + "," + str(param1[31]) + "," + str(param1[32]) + "," + str(param1[33]) + "," + str(param1[34])
  11.     return str(_loc3_).strip("()").encode('ascii')
  12.  
  13. def _StringifyNumArray(param1):
  14.     _loc2_ = ""
  15.     _loc3_ = int(0)
  16.     while _loc3_ < len(param1):
  17.         _loc2_ = str(_loc2_) + (str(param1[_loc3_]) + "_")
  18.         _loc3_ = _loc3_ + 1
  19.     return _loc2_
  20.  
  21. def _StringifyKeyArray(param1):
  22.     _loc2_ = ""
  23.     _loc3_ = 0
  24.     while _loc3_ < len(param1):
  25.         if param1[_loc3_] == False:
  26.             _loc2_ = _loc2_ + "-1_"
  27.         else:
  28.             _loc2_ = _loc2_ + (str(param1[_loc3_]) + "_")
  29.         _loc3_ = _loc3_ + 1
  30.     return _loc2_
  31.  
  32. def _StringifyBooleanArray(param1):
  33.     _loc2_ = ""
  34.     _loc3_ = int(0)
  35.     _loc4_ = int(0)
  36.     _loc7_ = int(0)
  37.     while _loc7_ < len(param1):
  38.         if param1[_loc7_]:
  39.             _loc2_ = _loc2_ + "ABCDEFGHIJKLM01234"[_loc3_]
  40.             _loc3_ = (_loc3_ + 1) % len("ABCDEFGHIJKLM01234")
  41.         else:
  42.             _loc2_ = _loc2_ + "NOPQRSTUVWXYZ56789"[_loc4_]
  43.             _loc4_ = (_loc4_ + 1) % len("NOPQRSTUVWXYZ56789")
  44.         _loc7_ = _loc7_ + 1
  45.     return _loc2_
  46.  
  47. def UpdatePassCode():
  48.     raw_date = datetime.datetime.now()
  49.     date_time = str(raw_date).split(" ")
  50.     date = date_time[0].split("-")
  51.     time = date_time[1].split(":")
  52.     _loc1_ = dec_data
  53.     _loc2_ = {"fullYear": date[0], "month": date[1], "day": date[2], "hours": time[0], "minutes": time[1]}
  54.     _loc3_ = _loc2_["fullYear"] + "-" + _loc2_["month"] + "-" + _loc2_["day"] + "-" + _loc2_["hours"] + ":" + _loc2_["minutes"]
  55.     _pass_code = "PHOENOTOPIA-" + _loc3_ + "-___" + str(base64.b64encode(_GameDataArrayToString(_loc1_))).strip("b''") + "___";
  56.     return _pass_code
  57.  
  58. print(UpdatePassCode())
  59.    
  60. input("Press enter to exit...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement