Crates.io | cashaddr |
lib.rs | cashaddr |
version | 0.2.0 |
source | src |
created_at | 2022-10-04 02:10:28.079417 |
updated_at | 2023-03-23 21:25:39.294413 |
description | Cashaddr codec library |
homepage | |
repository | https://gitlab.com/pezcore/cashaddr |
max_upload_size | |
id | 679569 |
size | 48,418 |
A library crate providing a dependency-free†, pure rust implementation of the cashaddr codec. Allows for transcoding between hashes and cashaddr strings.
† This Crate is only dependency-free if no optional crate features are enabled: enabling crate features can introduce third-party dependencies.
All crate features are disabled by default. The following optional crate features can be enabled to provide additional functionality:
convert
enables the [convert
] module which provides functions for
converting between cashaddr addresses and legacy Bitcoin addresses.Does not support Forward Error Correction. The BCH Codes used in the cashaddr codec technically allow for forward error correction, but using FEC in Bitcoin Cash addresses is dangerous and strongly discouraged.
Cashaddr is a base32-based encoding scheme designed to encode a hash
digest and hash type, which
describes the use case for the hash, as a string. A cashaddr string consists of
2 distinct parts separated by a colon (:
) in the following order:
HashType
]Together with the length field, the checksum provides extremely strong assurance that a received cashaddr string was not corrupted in transmission.
Currently, the only widespread use of cashaddr is for encoding Bitcoin Cash addresses, but its design features make it an attractive choice for a general-purpose text codec for hashes.
For details, see the cashaddr spec
Most of the codec algorithm logic was based on
bitcoincash-addr
.
This crate seeks to improve on bitcoincash-addr
by providing a more
generalized and ergonomic user interface, adding support for arbitrary
prefixes, and reducing scope to only matters directly related the cashaddr
codec itself (base58check codec removed from scope).