Skip to content

Instantly share code, notes, and snippets.

@Grazfather
Created September 4, 2017 18:11
Show Gist options
  • Save Grazfather/711976691c12b2035ebc14ab947c26bf to your computer and use it in GitHub Desktop.
Save Grazfather/711976691c12b2035ebc14ab947c26bf to your computer and use it in GitHub Desktop.
# Taken from the binary
gh = "A)\xd9e\xa1\xf1\xe1\xc9\x19\t\x93\x13\xa1\t\xb9I\xb9\x89\xdda1i\xa1\xf1q!\x9d\xd5=\x15\xd5"
mh = ""
def mirror_bits(c):
return (
(c & 1) << 7 |
(c & 2) << 5 |
(c & 4) << 3 |
(c & 8) << 1 |
(c & 16) >> 1 |
(c & 32) >> 3 |
(c & 64) >> 5 |
(c & 128) >> 7
)
for c in gh:
# Last thing done is flipping each bit
nc = 0xFF ^ ord(c)
# Second last thing: mirror each bit: 0b000000101 -> 0b10100000
mh += chr(mirror_bits(nc))
# First thing done: Reverse the string
print(mh[::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment