在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:multiformats/rust-multihash开源软件地址:https://github.com/multiformats/rust-multihash开源编程语言:Rust 97.2%开源软件介绍:rust-multihash
Table of ContentsInstallFirst add this to your [dependencies]
multihash = "*" Then run MSRV 1.51.0 due to use of const generics Usageuse multihash::{Code, MultihashDigest};
fn main() {
let hash = Code::Sha2_256.digest(b"my hash");
println!("{:?}", hash);
} Using a custom code tableYou can derive your own application specific code table: use multihash::derive::Multihash;
use multihash::MultihashCode;
#[derive(Clone, Copy, Debug, Eq, Multihash, PartialEq)]
#[mh(alloc_size = 64)]
pub enum Code {
#[mh(code = 0x01, hasher = multihash::Sha2_256)]
Foo,
#[mh(code = 0x02, hasher = multihash::Sha2_512)]
Bar,
}
fn main() {
let hash = Code::Foo.digest(b"my hash");
println!("{:02x?}", hash);
} Supported Hash Types
MaintainersCaptain: @dignifiedquire. ContributeContributions 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 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论