Skip to content

Instantly share code, notes, and snippets.

@bhrdn
Created December 13, 2018 01:19
Show Gist options
  • Save bhrdn/280aee03b8d7b3203e72dde1855307ef to your computer and use it in GitHub Desktop.
Save bhrdn/280aee03b8d7b3203e72dde1855307ef to your computer and use it in GitHub Desktop.
from string import ascii_lowercase as u
import string
with open('secret.txt') as f:
datas = f.read().splitlines()
datas = {
'plain': datas[0],
'key': map(lambda x: -int(x), datas[1].split(','))
}
assert len(datas['plain']) == len(datas['key'])
flag, shift = "", lambda x, y: x.lower().translate(string.maketrans(u, u[y:] + u[:y]))
for index, data in enumerate(datas['plain']):
flag += shift(data, datas['key'][index])
print flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment