Advertisement
Guest User

Cake day decode

a guest
Jan 28th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.77 KB | None | 0 0
  1. #Any variable with 'l' at the end is a list, any variable with an 's' at the end is a string
  2.  
  3. #The original post
  4. post = '#0#######1 #######2######## #######4#######5 #######6#######7 #######8#######9 #######0#######1 #######2######## #######4#######5 #######6#######7 #######8#######9 #######0#######1 #######2######## #######4#######5 #######6#######7 #######8#######9 #######0#######1 #######2######## #######4#######5 #######6#######7 #######8#######9 #######0###0#4#4 ###0#4#1#######1 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###0#4#4###0#4#1 #######2###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0#######8 ###2###0###2###0 ###2###0#######5 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###0#4#4 ###0#4#1######## ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###7#4#####2###0 ###2###0###2###0 ###7#4#####2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###0#4#4###0#4#1 #######4###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###5#4#6 ###5#4#6###5#4#6 ###5#4#6###7#4## ###5#4#6###5#4#6 ###5#4#6###7#4## ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###0#4#4 ###0#4#1#######5 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###6###1 ###2###0###2###0 ###7#4#####7#4#5 ###2###0###7#4#5 ###2###0###7#4#5 ###2###0###7#4#5 ###2###0###7#4#5 ###2###0###7#4#5 ###7#4#####2###0 ###2###0###2###0 #######8###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###0#4#4###0#4#1 #######6###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###7#4#####2###0 ###2###0###7#4## ###2###0###2###0 ###2###0###2###0 ###2###0#######4 ###2###0###2###0 ###2###0###2###0 ###2###0###7#4## ###2###0###2###0 ###2###0###7#4## ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###0#4#4 ###0#4#1#######7 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###5#4#6###5#4#6 ###5#4#6###7#4## ###5#4#6###5#4#6 ###7#4#####5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###7#4#####5#4#6 ###5#4#6###5#4#6 ###7#4#####5#4#6 ###5#4#6###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###0#4#4###0#4#1 #######8###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###7#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###7#4## ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###0#4#4 ###0#4#1#######9 ###2###0###2###0 ###2###0###2###0 #######0###2###0 ###2###0###2###0 ###7#4#####2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###7#4#####2###0 ###2###0###2###0 #######0###2###0 ###2###0###2###0 ###0#4#4###0#4#1 #######0###2###0 ###2###0###2###0 ###2###0###7#4## ###2###0###2###0 ###2###0###7#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###7#4## ###2###0###2###0 ###2###0###7#4## ###2###0###2###0 ###2###0###0#4#4 ###0#4#1#######1 ###2###0###2###0 ###2###0###5#4#6 ###7#4#####5#4#6 ###5#4#6###5#4#6 ###7#4#####5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###7#4#####5#4#6 ###5#4#6###5#4#6 ###7#4#####5#4#6 ###5#4#6###2###0 ###0#4#4###0#4#1 #######2###2###0 ###2###0###7#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###5#4## ###2#4#6###7#4## ###2###0###0#4#4 ###0#4#1######## ###2###0###2###0 ###7#4#####2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###7#4#####2###0 ###0#4#4###0#4#1 #######4###2###0 ###2###0###7#4## ###2###0###7###0 ###2###0###7###8 ###2###0###6###5 ###2###0###6###7 ###2###0###6###8 ###2###0###6#4#6 ###2###0###7###0 ###2###0###7###7 ###2###0###7###7 ###2###0###6#4## ###2###0###6###5 ###2###0###6#4#4 ###2###0###6#4#4 ###2###0###6#### ###2###0###6###8 ###2###0###6###5 ###2###0###6#4## ###2###0###7#4## ###2###0###0#4#4 ###0#4#1#######5 ###2###0###2###0 ###7#4#####2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#5###2###0 ###7#4#####2###0 ###0#4#4###0#4#1 #######6###2###0 ###2###0###7#4## ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###5#4#6 ###5#4#6###7#4## ###2###0###0#4#4 ###0#4#1#######7 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###0#4#4###0#4#1 #######8###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###0#4#4 ###0#4#1#######9 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0 ###2###0###2###0'
  5.  
  6. #Make the post into a list object with each character as an item so that it can be worked with
  7. postl = []
  8. for i in post:
  9.     postl.append(i)
  10.  
  11. #Make a function that when given text in a list form, it reverses it
  12. def reversetext(original):
  13.     reversed = []
  14.     a=len(original)
  15.     while a>=0:
  16.         reversed.append(original[a-1])
  17.         a=a-1
  18.     return reversed
  19.  
  20. postreversedl = reversetext(postl)
  21.  
  22. #Remove all of the spaces from the post
  23. postreversednsl = []
  24. for i in postreversedl:
  25.     if i != " ":
  26.         postreversednsl.append(i)
  27.  
  28. #Rebuild the post with every 4th character
  29. b=0
  30. c=1
  31. d=2
  32. e=3
  33. f=len(postreversednsl)
  34. postreversedns41l = [] #Reversed post with no spaces split into 4 lines, line 1 as a list
  35. postreversedns42l = [] #Reversed post with no spaces split into 4 lines, line 2 as a list
  36. postreversedns43l = []  #Reversed post with no spaces split into 4 lines, line 3 as a list
  37. postreversedns44l = [] #Reversed post with no spaces split into 4 lines, line 4 as a list
  38. while e<f:
  39.     postreversedns41l.append(postreversednsl[b])
  40.     b=b+4
  41.     postreversedns42l.append(postreversednsl[c])
  42.     c=c+4
  43.     postreversedns43l.append(postreversednsl[d])
  44.     d=d+4
  45.     postreversedns44l.append(postreversednsl[e])
  46.     e=e+4
  47.  
  48. #Make all of the #s in line 1 3s, and make the result a simpler name
  49. postreversedns413l = [] #Reversed post, no spaces, line 1 when split every 4 characters, with 3s instead of #s
  50. for i in postreversedns41l:
  51.     if i=='#':
  52.         postreversedns413l.append('3')
  53.     else:
  54.         postreversedns413l.append(i)
  55.  
  56. #Reverse the line and give it a better name
  57. line = reversetext(postreversedns413l)
  58.  
  59. #Split the line based on the 04013X repetitions
  60. split = []
  61. z=0
  62. y=5
  63. x=0
  64. w=len(line)
  65. while y<=w:
  66.     search = ''
  67.     search = search.join(line[z:y])
  68.     if search=='04013':
  69.         split.append(line[x:z-1])
  70.         split.append(line[z:y+1])
  71.         x=y+1
  72.     z=z+1
  73.     y=y+1
  74.  
  75. #Join each item in split into a string
  76. splitjoined = []
  77. for i in split:
  78.     joined = ''
  79.     joined = joined.join(i)
  80.     splitjoined.append(joined)
  81.  
  82. #Remove the 04013X lines
  83. almostthere=[]
  84. for i in splitjoined:
  85.     if i[:-1]!='04013':
  86.         almostthere.append(i)
  87.  
  88. #Decode the lines into ASCII and make it into a separate list
  89. decoded = []
  90. for i in almostthere:
  91.     decoded.append(''.join([chr(int(''.join(c), 16)) for c in zip(i[0::2],i[1::2])]))
  92.     #Yea thats some HEX to ASCII code I pulled from the interwebs cause decode and binascii wouldn't work
  93.  
  94. #Display the output
  95. for i in decoded:
  96.     print i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement