fork download
  1. import base64
  2.  
  3. # Hi
  4. # 7 - 34
  5. # 000111 - 100010
  6. # 0001 - 1110 - 0010 = 0x1E2 = 482
  7.  
  8. # 1
  9. integer = int(bin(482)[-12:] + '0' * 20, 2)
  10. encoded = base64.b64encode(base64.b16decode('{0:08X}'.format(integer)))
  11. print encoded
  12.  
  13. # 2
  14. encoded = base64.b64encode(base64.b16decode('{0:08X}'.format(482 << 20)))
  15. print encoded
Success #stdin #stdout 0.01s 7852KB
stdin
Standard input is empty
stdout
HiAAAA==
HiAAAA==