MCPcopy Create free account
hub / github.com/ccxt/ccxt / CheckEncode

Method CheckEncode

python/ccxt/static_dependencies/bip/base58/base58.py:112–129  ·  view source on GitHub ↗

Encode bytes into Base58 string with checksum. Args: data_bytes (bytes) : Data bytes alph_idx (Base58Alphabets, optional): Alphabet index, Bitcoin by default Returns: str: Encoded string with checksum Raises:

(data_bytes: bytes,
                    alph_idx: Base58Alphabets = Base58Alphabets.BITCOIN)

Source from the content-addressed store, hash-verified

110
111 @staticmethod
112 def CheckEncode(data_bytes: bytes,
113 alph_idx: Base58Alphabets = Base58Alphabets.BITCOIN) -> str:
114 """
115 Encode bytes into Base58 string with checksum.
116
117 Args:
118 data_bytes (bytes) : Data bytes
119 alph_idx (Base58Alphabets, optional): Alphabet index, Bitcoin by default
120
121 Returns:
122 str: Encoded string with checksum
123
124 Raises:
125 TypeError: If alphabet index is not a Base58Alphabets enumerative
126 """
127
128 # Append checksum and encode all together
129 return Base58Encoder.Encode(data_bytes + Base58Utils.ComputeChecksum(data_bytes), alph_idx)
130
131
132class Base58Decoder:

Callers 3

EncodeMethod · 0.80
SerializeMethod · 0.80
EncodeKeyMethod · 0.80

Calls 2

EncodeMethod · 0.45
ComputeChecksumMethod · 0.45

Tested by

no test coverage detected