Created
May 24, 2021 14:33
-
-
Save ElliotFriend/8e0451f0b03277867325de6f8a92eff7 to your computer and use it in GitHub Desktop.
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
# what initially failed | |
n = 63 | |
chunks = [jwt_token[i:i+n] for i in range(0, len(jwt_token), n)] | |
i = 0 | |
jwt_dict = {} | |
while chunks: | |
index_data = f"{i:02d}" | |
key = index_data + chunks.pop(0) | |
last_char = key[-1] | |
key = key.rstrip(key[-1]) | |
val = (last_char + chunks.pop(0)) if chunks else '' | |
jwt_dict[key] = val | |
i += 1 | |
print(jwt_dict) | |
# what finally worked | |
n = 62 | |
chunks = [jwt_token[i:i+n] for i in range(0, len(jwt_token), n)] | |
i = 0 | |
jwt_dict = {} | |
while chunks: | |
index_data = f"{i:02d}" | |
key = index_data + chunks.pop(0) | |
# last_char = key[-1] | |
# key = key.rstrip(key[-1]) | |
# val = (last_char + chunks.pop(0)) if chunks else '' | |
val = (chunks.pop(0)) if chunks else '' | |
jwt_dict[key] = val | |
i += 1 | |
print(jwt_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment