Crates.io | hcid |
lib.rs | hcid |
version | 0.0.6 |
source | src |
created_at | 2019-02-14 21:09:21.250611 |
updated_at | 2019-05-03 21:22:39.481743 |
description | Holochain base32 encoding scheme for keys, agents, identifiers, etc |
homepage | |
repository | https://github.com/holochain/hcid |
max_upload_size | |
id | 114820 |
size | 28,674 |
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);
}