ubinascii.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. :mod:`ubinascii` -- binary/ASCII conversions
  2. ============================================
  3. .. module:: ubinascii
  4. :synopsis: binary/ASCII conversions
  5. |see_cpython_module| :mod:`python:binascii`.
  6. This module implements conversions between binary data and various
  7. encodings of it in ASCII form (in both directions).
  8. Functions
  9. ---------
  10. .. function:: hexlify(data, [sep])
  11. Convert binary data to hexadecimal representation. Returns bytes string.
  12. .. admonition:: Difference to CPython
  13. :class: attention
  14. If additional argument, *sep* is supplied, it is used as a separator
  15. between hexadecimal values.
  16. .. function:: unhexlify(data)
  17. Convert hexadecimal data to binary representation. Returns bytes string.
  18. (i.e. inverse of hexlify)
  19. .. function:: a2b_base64(data)
  20. Decode base64-encoded data, ignoring invalid characters in the input.
  21. Conforms to `RFC 2045 s.6.8 <https://tools.ietf.org/html/rfc2045#section-6.8>`_.
  22. Returns a bytes object.
  23. .. function:: b2a_base64(data)
  24. Encode binary data in base64 format, as in `RFC 3548
  25. <https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
  26. followed by a newline character, as a bytes object.