API Reference

multibase.encode(encoding, data)[source]

Encodes the given data using the encoding that is specified

Parameters:
  • encoding (str) – encoding to use, should be one of the supported encoding
  • data (str or bytes) – data to encode
Returns:

multibase encoded data

Return type:

bytes

Raises:

ValueError – if the encoding is not supported

multibase.decode(data)[source]

Decode the multibase decoded data :param data: multibase encoded data :type data: str or bytes :return: decoded data :rtype: str :raises ValueError: if the data is not multibase encoded

multibase.get_codec(data)[source]

Returns the codec used to encode the given data

Parameters:data (str or bytes) – multibase encoded data
Returns:the multibase.Encoding object for the data’s codec
Raises:ValueError – if the codec is not supported
multibase.is_encoded(data)[source]

Checks if the given data is encoded or not

Parameters:data (str or bytes) – multibase encoded data
Returns:if the data is encoded or not
Return type:bool