Skip to content

Instantly share code, notes, and snippets.

@iokiwi
Created December 31, 2018 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iokiwi/5cc6de78764c762fbe7aba126dc15f6d to your computer and use it in GitHub Desktop.
Save iokiwi/5cc6de78764c762fbe7aba126dc15f6d to your computer and use it in GitHub Desktop.
import string
k = 13
c = """Uryyb naq jrypbzr gb gur xvjvpba onqtr Chmmyr, lbh qvfpbirerq gur svefg pyhr naq unir fgnegrq gur chmmyr jryy qbar! gb unir lbhe fpber qvfcynlrq ba gur znva yrnqreobneq, abj fraq n grkg zrffntr sebz lbhe cubar gb mreb gjb frira bar mreb mreb frira gjb gjb mreb avar pbanvavat bayl ibhe ertvfgenvba vq ahzore. Qhr gb fvmr pbapreaf envfrq blre fnsrgl naq gUr cHoyvp vzntr bs gur xvjvpba betnavfngvba, gur fgbel ryrzragf bs gur punyyratr jvyy abg or gnxvat cynpr guvf lrne. ABgujvgufgnaqvat, gurer jvyy or cyragl bs sha chmmyrf uvqqra guebhtubhg gur pba naq irahr fb unir sha naq tbbq yhpx! xvaq ertneqf, zvxr. RAQ bs zrffntr qngn"""
#c = """Hello and welcome to the kiwicon badge Puzzle, you discovered the first clue and have started the puzzle well done! to have your score displayed on the main leaderboard, now send a text message from your phone to zero two seven one zero zero seven two two zero nine conaining only vour registraion id number. Due to size concerns raised oyer safety and tHe pUblic image of the kiwicon organisation, the story elements of the challenge will not be taking place this year. NOthwithstanding, there will be plenty of fun puzzles hidden throughout the con and venue so have fun and good luck! kind regards, mike. END of message data."""
def convert(key, char, offset):
return chr(((ord(char) - offset + key) % 26) + offset)
def decrypt_char(k, char):
if char in string.ascii_lowercase:
return convert(k, char, ord('a'))
elif char in string.ascii_uppercase:
return convert(k, char, ord('A'))
else:
return char
def decrypt_text(k, cypher_text):
plain_text = "".join([decrypt_char(k, x) for x in cypher_text])
return plain_text
def print_decode_table(k):
print("k = {}".format(k))
for i in range(ord('A'), ord('Z')+1):
print chr(i), "=>", decrypt_char(k, chr(i))
print_decode_table(k)
print(decrypt_text(k, c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment