MCPcopy Index your code
hub / github.com/RustPython/RustPython / b85encode

Function b85encode

Lib/base64.py:442–454  ·  view source on GitHub ↗

Encode bytes-like object b in base85 format and return a bytes object. If pad is true, the input is padded with b'\\0' so its length is a multiple of 4 bytes before encoding.

(b, pad=False)

Source from the content-addressed store, hash-verified

440_b85dec = None
441
442def b85encode(b, pad=False):
443 """Encode bytes-like object b in base85 format and return a bytes object.
444
445 If pad is true, the input is padded with b'\\0' so its length is a multiple of
446 4 bytes before encoding.
447 """
448 global _b85chars, _b85chars2
449 # Delay the initialization of tables to not waste memory
450 # if the function is never called
451 if _b85chars2 is None:
452 _b85chars = [bytes((i,)) for i in _b85alphabet]
453 _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
454 return _85encode(b, _b85chars, _b85chars2, pad)
455
456def b85decode(b):
457 """Decode the base85-encoded bytes-like object or ASCII string b

Callers 1

z85encodeFunction · 0.85

Calls 1

_85encodeFunction · 0.85

Tested by

no test coverage detected