#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

#143 in Encoding

Download history 2192/week @ 2019-12-02 1847/week @ 2019-12-09 613/week @ 2019-12-16 524/week @ 2019-12-23 386/week @ 2019-12-30 303/week @ 2020-01-06 474/week @ 2020-01-13 222/week @ 2020-01-20 270/week @ 2020-01-27 394/week @ 2020-02-03 559/week @ 2020-02-10 237/week @ 2020-02-17 314/week @ 2020-02-24 355/week @ 2020-03-02 427/week @ 2020-03-09 210/week @ 2020-03-16

7,510 downloads per month
Used in 31 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