Skip to content

Instantly share code, notes, and snippets.

@idlesign
Last active November 4, 2015 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idlesign/4b3f25582df4e694e911 to your computer and use it in GitHub Desktop.
Save idlesign/4b3f25582df4e694e911 to your computer and use it in GitHub Desktop.
Data size growth for various base64 module functions.
from base64 import *
with open('/home/idle/binary.data', 'rb') as f:
data = f.read()
for method in [b64encode, b32encode, b16encode, a85encode, b85encode]:
percent = ((len(method(data)) * 100) / len(data)) - 100
print('%s: +%s%%' % (method.__name__, round(percent, 2)))
@idlesign
Copy link
Author

idlesign commented Nov 4, 2015

Output:

b64encode: +33.33%
b32encode: +60.0%
b16encode: +100.0%
a85encode: +25.0%
b85encode: +25.0%

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