Created
April 29, 2024 00:15
-
-
Save lukacat10/0b0870b735d67993b8a31a1c8a762fdb to your computer and use it in GitHub Desktop.
Adds padding to base64 string if missing. Helps when using sensitive base64 parsers.
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
def add_padding(encoded_string): | |
missing_padding = len(encoded_string) % 4 | |
if missing_padding != 0: | |
encoded_string += "=" * (4 - missing_padding) | |
return encoded_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Public due to small code with minimal attack surface.