`base2048` is a Python library that provides efficient binary encoding and decoding using the Base2048 scheme, implemented as a Rust extension for performance. It offers simple functions to convert bytes to Base2048 strings and vice-versa. The current version is 0.1.3, and it functions as a stable utility library with infrequent updates, focusing on its core encoding capabilities.
pip install base2048Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to encode `bytes` to a Base2048 string and decode it back. It also shows the necessary steps to handle text (Unicode) by explicitly converting it to bytes before encoding and back to a string after decoding.
Always convert your string data to `bytes` using an appropriate encoding (e.g., `my_string.encode('utf-8')`) before passing it to `encode()`.Ensure the input to `decode()` is a `str`. The output of `encode()` is already a `str`, so no conversion is needed for decoding its direct result.
For text, the workflow should be: `text_str.encode('utf-8')` -> `encode()` -> `decode()` -> `decoded_bytes.decode('utf-8')`.Convert the string to bytes first: `encoded_data = base2048.encode('my string'.encode('utf-8'))`.The input to `base2048.decode()` must be a Python `str`. Ensure you are passing the string output from `base2048.encode()` or a valid Base2048 string.
Install the library using pip: `pip install base2048`.
No dependency data recorded yet.