Last active
April 12, 2020 23:57
-
-
Save macostag/403b18b069e92e1cf84b768c33a72b0d to your computer and use it in GitHub Desktop.
Encoding and decoding Base64 (Nonstandard Bas64 character set)
This file contains hidden or 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 base64 | |
chr_set = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" | |
non_chr_set = "0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=" | |
encoded = "G6JgP6w=" | |
re_encoded = "" | |
for en_chr in encoded: | |
re_encoded += en_chr.replace(en_chr,chr_set[non_chr_set.find(en_chr)]) | |
decoded = base64.b64decode(re_encoded) | |
print decoded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment