Skip to content

Instantly share code, notes, and snippets.

@tbbooher
Created April 5, 2021 12:36
Show Gist options
  • Select an option

  • Save tbbooher/7323fb42e88e544d3d50086785294b52 to your computer and use it in GitHub Desktop.

Select an option

Save tbbooher/7323fb42e88e544d3d50086785294b52 to your computer and use it in GitHub Desktop.
ltrs = "灩捯䍔䙻ㄶ形楴獟楮獴㌴摟潦弸弰㑣〷㘰摽"
nums = [ord(l) for l in ltrs]
# picoCTF 2021
# ''.join([chr((ord(flag[i]) << 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)])
# cf https://play.picoctf.org/practice/challenge/104?originalEvent=34&page=1&search=
chars = []
for l in ltrs:
int_char = ord(l)
offset = (int_char >> 8)
char1 = chr(offset)
chars.append(char1)
char2 = chr(int_char - (offset << 8))
chars.append(char2)
# print(chr(ord(l) >> 8),chr(ord(l)))
# ''.join([chr((ord(flag[i]) << 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)])
print(''.join(chars))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment