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)
| 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 | |
| 132 | class Base58Decoder: |
no test coverage detected