Advertisement
here2share

# b_zlib_base64.py

May 30th, 2018
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # b_zlib_base64.py
  2. import zlib, base64
  3.  
  4. s = 'blah blah blah blah blah blah blah blah blah blah blah blah'
  5. compressed = zlib.compress(s)
  6. print 'zlib (Non-Websafe):'
  7. print compressed
  8. print
  9. b64 = base64.encodestring(s)
  10. print 'Base64 Without zlib:'
  11. print b64
  12. zlib2base64= base64.encodestring(compressed)
  13. print 'Base64 With zlib:'
  14. print zlib2base64
  15.  
  16. b64decoded = base64.decodestring(zlib2base64)
  17. decompressed = zlib.decompress(b64decoded)
  18. print 'String Normalized:'
  19. print decompressed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement