Skip to content

Instantly share code, notes, and snippets.

@s3cpat
Created July 31, 2018 12:10
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 s3cpat/66aec981831c3836261f585dbd30f443 to your computer and use it in GitHub Desktop.
Save s3cpat/66aec981831c3836261f585dbd30f443 to your computer and use it in GitHub Desktop.
secret!!
import binascii
z = '0x1F499'
o = '0x1F618'
def create_emoji_string(string):
s = string.replace("0b","")
out = ""
for chr in s:
if chr == '0':
out+=z
else:
out+=o
return out
def revert_emoji_string(string):
s = string.replace(" ","")
s = s.replace(z,'0')
s = s.replace(o,'1')
return s
def enc(string):
# print("encoding '" + string + "' ...")
s = bin(int(binascii.hexlify(string), 16))
return create_emoji_string(s)
def dec(string):
# print("decoding '" + string + "' ...")
s = revert_emoji_string(string)
n = int('0b'+s, 2)
return binascii.unhexlify('%x'%n)
encoded = enc("Example String")
decoded = dec(encoded)
print encoded
print decoded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment