Created
June 3, 2021 12:05
-
-
Save pyar6329/67cd1ee581eddc17af09dfac703a0736 to your computer and use it in GitHub Desktop.
base64 URL encoding vs URL encoding
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 json | |
import random | |
style = ["Structured", "Plain"] | |
max_size = 320 | |
dic = {i: style[random.randint(0, 1)] for i in range(max_size)} | |
json_dic = json.dumps(dic,ensure_ascii=False) | |
print(json_dic) |
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
#!/bin/bash | |
python main.py | jq -c -r > main.json | |
cat main.json | base64 -w 0 | tr '/+' '_-' | tr -d '=' > base64url.txt | |
cat main.json | nkf -WwMQ | sed 's/=$//g' | tr = % | tr -d '\n' > url_encode.txt | |
wc -m *.txt |
Author
pyar6329
commented
Jun 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment