#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

#103 in Encoding

Download history 2063/week @ 2019-08-06 871/week @ 2019-08-13 972/week @ 2019-08-20 758/week @ 2019-08-27 960/week @ 2019-09-03 1002/week @ 2019-09-10 2044/week @ 2019-09-17 1182/week @ 2019-09-24 2253/week @ 2019-10-01 1348/week @ 2019-10-08 1372/week @ 2019-10-15 1934/week @ 2019-10-22 2153/week @ 2019-10-29 2688/week @ 2019-11-05 1766/week @ 2019-11-12

5,498 downloads per month
Used in 27 crates (7 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