Skip to content

Instantly share code, notes, and snippets.

@lukacat10
Created April 29, 2024 00:15
Show Gist options
  • Save lukacat10/0b0870b735d67993b8a31a1c8a762fdb to your computer and use it in GitHub Desktop.
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.
def add_padding(encoded_string):
missing_padding = len(encoded_string) % 4
if missing_padding != 0:
encoded_string += "=" * (4 - missing_padding)
return encoded_string
@lukacat10
Copy link
Author

Public due to small code with minimal attack surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment