#base32 #encoding #decoding #erasure #reed-solomon

hcid

Holochain base32 encoding scheme for keys, agents, identifiers, etc

2 releases

✓ Uses Rust 2018 edition

0.0.6 May 3, 2019
0.0.3-alpha Feb 14, 2019

#100 in Encoding

Download history 1238/week @ 2019-03-24 1240/week @ 2019-03-31 761/week @ 2019-04-07 208/week @ 2019-04-14 174/week @ 2019-04-21 346/week @ 2019-04-28 683/week @ 2019-05-05 1523/week @ 2019-05-12 1519/week @ 2019-05-19 2222/week @ 2019-05-26 2349/week @ 2019-06-02 1399/week @ 2019-06-09 1391/week @ 2019-06-16 1650/week @ 2019-06-23 2053/week @ 2019-06-30

5,498 downloads per month
Used in 11 crates (4 directly)

Apache-2.0

26KB
468 lines

hcid

Holochain base32 encoding scheme for keys, agents, identifiers, etc.

extern crate hcid;

fn main() {
    let enc = hcid::HcidEncoding::with_kind("hcs0").unwrap();
    let key = enc.encode(&[0; 32]).unwrap();
    assert_eq!("HcSciaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", key);
    let buffer = enc.decode(&key).unwrap();
    assert_eq!([0; 32].to_vec(), buffer);
}

lib.rs:

Holochain HCID base32 encoding utility.

Example

extern crate hcid;

fn main() {
    let enc = hcid::HcidEncoding::with_kind("hcs0").unwrap();
    let key = enc.encode(&[0; 32]).unwrap();
    assert_eq!("HcSciaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", key);
    let buffer = enc.decode(&key).unwrap();
    assert_eq!([0; 32].to_vec(), buffer);
}

Dependencies

~51KB