11 releases

0.3.0 Oct 1, 2020
0.2.8 Sep 18, 2020
0.2.5 Aug 30, 2020
0.1.0 Aug 19, 2020

#3 in #multiformats

Download history 154/week @ 2021-07-04 72/week @ 2021-07-11 107/week @ 2021-07-18 57/week @ 2021-07-25 92/week @ 2021-08-01 51/week @ 2021-08-08 87/week @ 2021-08-15 52/week @ 2021-08-22 33/week @ 2021-08-29 8/week @ 2021-09-05 26/week @ 2021-09-12 35/week @ 2021-09-19 140/week @ 2021-09-26 31/week @ 2021-10-03 133/week @ 2021-10-10 274/week @ 2021-10-17

443 downloads per month

MIT license

20KB
420 lines

rust-cid

Build Status Crates.io License Documentation Dependency Status Coverage Status

CID implementation in Rust.

Table of Contents

Install

First add this to your Cargo.toml

[dependencies]
cid = "*"
multihash = "0.10"

Then run cargo build.

Usage

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
}

Maintainers

Captain: @dignifiedquire.

Contribute

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.

License

MIT © 2017 Friedel Ziegelmayer

Dependencies

~245–750KB
~17K SLoC

v_