cashaddr 0.1.0

Cashaddr codec library
Documentation

Implements cashaddr encoding for arbitrary borrowed sequences of u8. The main use of this crate is via the [CashEnc] trait which provides and implementation for encoding any borrowed sequence of u8 into a cashaddr string with arbirary prefix.

Examples

use hex;
use cashaddr::{CashEnc, HashType};
let payload = hex::decode("F5BF48B397DAE70BE82B3CCA4793F8EB2B6CDAC9").unwrap();
let cashaddr = "bchtest:pr6m7j9njldwwzlg9v7v53unlr4jkmx6eyvwc0uz5t";
assert_eq!(payload.encode("bchtest", HashType::P2SH).unwrap(), cashaddr);

Atrribution

Most of this code was forked from bitcoincash-addr. This library was created to both provide a more convenient user interface, as well as support arbitrary prefixes.