Created
July 31, 2018 12:10
-
-
Save s3cpat/66aec981831c3836261f585dbd30f443 to your computer and use it in GitHub Desktop.
secret!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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