Skip to content

A library for converting to/from base-58

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

nham/rust-base58

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-base58

Conversion library for base-58. Currently it uses the Bitcoin base58 alphabet:

123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

Usage

Add this to Cargo.toml:

[dependencies]
rust-base58 = "*"

and use it like this:

extern crate rust_base58;

use rust_base58::{ToBase58, FromBase58};

fn main() {
    let x = &[1, 2, 3];

    // to_base58() returns a String
    let x_b58 = x.to_base58();
    assert_eq!("Ldp", x_b58);

    // from_base58() returns a Vec<u8>
    let x_again = x_b58.from_base58().unwrap();
    assert_eq!(x, &x_again[..]);

    // from_base58() can fail, for example due to the input string
    // containing an invalid base58 character like "I":
    assert!("I".from_base58().is_err());
}

About

A library for converting to/from base-58

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages