Crate hcid

Source
Expand description

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);
}

Structs§

  • an instance that can encode / decode a particular hcid encoding configuration
  • represents an encoding configuration for hcid rendering and parsing
  • a simple struct(String) for reporting hcid errors

Type Aliases§