Crates.io | tiny-cid |
lib.rs | tiny-cid |
version | 0.3.0 |
source | src |
created_at | 2020-08-19 17:42:50.979213 |
updated_at | 2020-10-01 18:11:35.526749 |
description | CID in rust |
homepage | https://github.com/multiformats/rust-cid |
repository | |
max_upload_size | |
id | 278262 |
size | 26,330 |
CID implementation in Rust.
First add this to your Cargo.toml
[dependencies]
cid = "*"
multihash = "0.10"
Then run cargo build
.
use cid::{Cid, Codec, Version};
use multihash::Sha2_256;
use std::convert::TryFrom;
fn main() {
let h = Sha2_256::digest(b"beep boop");
let cid = Cid::new(Version::V1, Codec::DagProtobuf, h).unwrap();
let data = cid.to_bytes();
let out = Cid::try_from(data).unwrap();
assert_eq!(cid, out);
let cid_string = cid.to_string();
/// bafybeieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq
}
Captain: @dignifiedquire.
Contributions welcome. Please check out the issues.
Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.
Small note: If editing the README, please conform to the standard-readme specification.
MIT © 2017 Friedel Ziegelmayer