101 lines
3.2 KiB
Text
101 lines
3.2 KiB
Text
Metadata-Version: 2.1
|
|
Name: based58
|
|
Version: 0.1.0
|
|
Classifier: Programming Language :: Rust
|
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
Summary: A fast Python library for Base58 and Base58Check
|
|
Author-email: kevinheavey <kevinheavey123@gmail.com>
|
|
License: MIT License
|
|
|
|
Copyright (c) 2022 Kevin Heavey
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
Requires-Python: >=3.7
|
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
Project-URL: repository, https://github.com/kevinheavey/based58
|
|
Project-URL: homepage, https://github.com/kevinheavey/based58
|
|
Project-URL: documentation, https://kevinheavey.github.io/based58/
|
|
Project-URL: changelog, https://github.com/kevinheavey/based58/blob/main/CHANGELOG.md
|
|
|
|
# based58
|
|
|
|
A fast base-58 Python library
|
|
|
|
`based58` is a fast Python library for
|
|
[Base58](https://en.wikipedia.org/wiki/Binary-to-text_encoding#Base58)
|
|
encoding and decoding. It includes support for Base58Check and configurable alphabets.
|
|
|
|
It is
|
|
[significantly faster](https://gist.github.com/kevinheavey/2abad728d7658c136de0078d667d7267)
|
|
than the pure-Python
|
|
[base58 library](https://gist.github.com/kevinheavey/2abad728d7658c136de0078d667d7267),
|
|
as it calls the Rust [bs58 library](https://github.com/mycorrhiza/bs58-rs)
|
|
under the hood.
|
|
|
|
The API mimics that of the `base58` library, with the exception that string inputs are not
|
|
supported, only bytes.
|
|
|
|
## Installation
|
|
|
|
pip install based58
|
|
|
|
Note: requires Python >= 3.7.
|
|
|
|
## Usage
|
|
|
|
```python
|
|
>>> import based58
|
|
>>> data = [1, 2, 3]
|
|
>>> based58.b58encode(b'hello world')
|
|
b'StV1DL6CwTryKyV'
|
|
>>> based58.b58decode(b'StV1DL6CwTryKyV')
|
|
b'hello world'
|
|
>>> based58.b58encode_check(b'hello world')
|
|
b'3vQB7B6MrGQZaxCuFg4oh'
|
|
>>> based58.b58decode_check(b'3vQB7B6MrGQZaxCuFg4oh')
|
|
b'hello world'
|
|
>>> based58.b58encode(b'hello world', alphabet=based58.Alphabet.RIPPLE)
|
|
b'StVrDLaUATiyKyV'
|
|
>>> based58.b58decode(b'StVrDLaUATiyKyV', alphabet=based58.Alphabet.RIPPLE)
|
|
b'hello world'
|
|
```
|
|
|
|
## Development
|
|
|
|
### Setup
|
|
|
|
1. Install [poetry](https://python-poetry.org/)
|
|
2. Install dev dependencies:
|
|
|
|
```
|
|
poetry install
|
|
```
|
|
|
|
3. Activate the poetry shell:
|
|
|
|
```sh
|
|
poetry shell
|
|
```
|
|
|
|
### Testing
|
|
|
|
1. Run `maturin develop` to compile the Rust code.
|
|
2. Run `make fmt`, `make lint`, and `make test`.
|
|
|