This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 14th, 2011  |  syntax: None  |  size: 0.94 KB  |  views: 68  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # binascii
  2. import binascii
  3. str = 'my guitar wants to strum all night long'
  4. code_map = {
  5.     'b2a_qp':'a2b_qp',
  6.     'b2a_uu':'a2b_uu',
  7.     'b2a_hex':'a2b_hex',
  8.     'b2a_hqx':'a2b_hqx',
  9.     'b2a_base64':'a2b_base64',
  10.     'rlecode_hqx':'rledecode_hqx',
  11.     'hexlify':'unhexlify',
  12. }
  13.  
  14. b2a = binascii.b2a_qp(str)
  15. print repr(b2a)
  16. a2b = binascii.a2b_qp(b2a)
  17. print repr(a2b)
  18.  
  19. b2a = binascii.b2a_uu(str)
  20. print repr(b2a)
  21. a2b = binascii.a2b_uu(b2a)
  22. print repr(a2b)
  23.  
  24. b2a = binascii.b2a_hex(str)
  25. print repr(b2a)
  26. a2b = binascii.a2b_hex(b2a)
  27. print repr(a2b)
  28.  
  29. b2a = binascii.b2a_hqx(str)
  30. print repr(b2a)
  31. a2b = binascii.a2b_hqx(b2a)
  32. print repr(a2b)
  33.  
  34. b2a = binascii.b2a_base64(str)
  35. print repr(b2a)
  36. a2b = binascii.a2b_base64(b2a)
  37. print repr(a2b)
  38.  
  39. b2a = binascii.rlecode_hqx(str)
  40. print repr(b2a)
  41. a2b = binascii.rledecode_hqx(b2a)
  42. print repr(a2b)
  43.  
  44. b2a = binascii.hexlify(str)
  45. print repr(b2a)
  46. a2b = binascii.unhexlify(b2a)
  47. print repr(a2b)
clone this paste RAW Paste Data