Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
run: cargo test --verbose --all-features

msrv:
name: Verify MSRV (1.85)
name: Verify MSRV (1.99)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Rust Toolchain (1.85)
uses: dtolnay/rust-toolchain@1.85.0
- name: Install Rust Toolchain (1.99)
uses: dtolnay/rust-toolchain@1.99.0

- name: Check
run: cargo check --all-features
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2026-10-08

### Changed

- Raised the `multi-hash` requirement 1.1.2 → 2.0 and migrated the tests, benchmarks, and doc examples from the removed `Builder::new_from_bytes` API to the streaming builder shape (`Builder::new(codec)?` + `update(bytes)` + `try_build()`). The crate requires multi-hash 2.0.0, which declares `rust-version = "1.99"`. No public API changes.
- Raised the MSRV from 1.85 to 1.99 and applied clippy 0.1.99 fixes.

## [0.2.0] - 2026-08-18

### Changed
Expand Down Expand Up @@ -56,6 +63,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- The `multi-base`, `multi-codec`, `multi-hash`, `multi-trait`, and `multi-util` dependencies use the published crates.io versions.

[0.3.0]: https://github.com/cryptidtech/multi-cid/releases/tag/v0.3.0

[0.2.0]: https://github.com/cryptidtech/multi-cid/releases/tag/v0.2.0

[0.1.0]: https://github.com/cryptidtech/multi-cid/releases/tag/v0.1.0
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "multi-cid"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
rust-version = "1.85"
rust-version = "1.99"
authors = ["Dave Grantham <dwg@linuxprogrammer.org>"]
description = "Content Identifier (CID) implementation compatible with IPFS and IPLD"
repository = "https://github.com/cryptidtech/multi-cid.git"
Expand All @@ -16,12 +16,12 @@ default = ["serde", "dag_cbor"]
dag_cbor = ["dep:multi-cbor", "multi-cbor/tags"]

[dependencies]
multi-base = { version = "1.0", default-features = false }
multi-cbor = { version = "0.1", optional = true }
multi-codec = "1.2"
multi-hash = "1.1.2"
multi-trait = { version = "1.0", default-features = false }
multi-util = "1.1"
multi-base = { version = "1.1", default-features = false }
multi-cbor = { version = "0.2", optional = true }
multi-codec = "1.6"
multi-hash = "2.0"
multi-trait = { version = "1.1", default-features = false }
multi-util = "1.2"
thiserror = "2.0"
serde = { version = "1.0", default-features = false, features = [
"alloc",
Expand All @@ -31,7 +31,7 @@ serde = { version = "1.0", default-features = false, features = [
[dev-dependencies]
criterion = "0.8"
hex = "0.4"
multi-cbor = "0.1"
multi-cbor = "0.2"
proptest = "1.11"
serde_json = "1.0"
serde_test = "1.0"
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ For DAG-CBOR tag 42 support:
multi-cid = { version = "0.1", features = ["dag_cbor"] }
```

MSRV: Rust 1.85 (Edition 2021).
MSRV: Rust 1.99 (Edition 2021).

## Usage

Expand All @@ -63,10 +63,9 @@ use multi_codec::Codec;
use multi_hash::Builder as MhBuilder;

// Create a multihash
let hash = MhBuilder::new_from_bytes(Codec::Sha2256, b"hello world")
.unwrap()
.try_build()
.unwrap();
let mut hasher = MhBuilder::new(Codec::Sha2256).unwrap();
hasher.update(b"hello world");
let hash = hasher.try_build().unwrap();

// Create a CID v1
let cid = cid::Builder::new(Codec::Sha2256)
Expand Down
14 changes: 6 additions & 8 deletions benches/multicid_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ use std::hint::black_box;

/// Benchmark CID encoding
fn bench_cid_encoding(c: &mut Criterion) {
let hash = MhBuilder::new_from_bytes(Codec::Sha2256, b"benchmark data")
.unwrap()
.try_build()
.unwrap();
let mut hasher = MhBuilder::new(Codec::Sha2256).unwrap();
hasher.update(b"benchmark data");
let hash = hasher.try_build().unwrap();

let cid = cid::Builder::new(Codec::Cidv1)
.with_target_codec(Codec::DagCbor)
Expand All @@ -30,10 +29,9 @@ fn bench_cid_encoding(c: &mut Criterion) {

/// Benchmark CID decoding
fn bench_cid_decoding(c: &mut Criterion) {
let hash = MhBuilder::new_from_bytes(Codec::Sha2256, b"benchmark data")
.unwrap()
.try_build()
.unwrap();
let mut hasher = MhBuilder::new(Codec::Sha2256).unwrap();
hasher.update(b"benchmark data");
let hash = hasher.try_build().unwrap();

let cid = cid::Builder::new(Codec::Cidv1)
.with_target_codec(Codec::DagCbor)
Expand Down
54 changes: 18 additions & 36 deletions src/cid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,10 @@ mod tests {

#[test]
fn test_v0() {
let mut hasher = mh::Builder::new(Codec::Sha2256).unwrap();
hasher.update(b"for great justice, move every zig!");
let v0 = Builder::default()
.with_hash(
&mh::Builder::new_from_bytes(Codec::Sha2256, b"for great justice, move every zig!")
.unwrap()
.try_build()
.unwrap(),
)
.with_hash(&hasher.try_build().unwrap())
.try_build()
.unwrap();

Expand Down Expand Up @@ -371,13 +368,10 @@ mod tests {

#[test]
fn test_v0_binary_roundtrip() {
let mut hasher = mh::Builder::new(Codec::Sha2256).unwrap();
hasher.update(b"for great justice, move every zig!");
let v0 = Builder::default()
.with_hash(
&mh::Builder::new_from_bytes(Codec::Sha2256, b"for great justice, move every zig!")
.unwrap()
.try_build()
.unwrap(),
)
.with_hash(&hasher.try_build().unwrap())
.try_build()
.unwrap();
let v: Vec<u8> = v0.clone().into();
Expand All @@ -386,13 +380,10 @@ mod tests {

#[test]
fn test_v0_encoded_roundtrip() {
let mut hasher = mh::Builder::new(Codec::Sha2256).unwrap();
hasher.update(b"for great justice, move every zig!");
let v0 = Builder::default()
.with_hash(
&mh::Builder::new_from_bytes(Codec::Sha2256, b"for great justice, move every zig!")
.unwrap()
.try_build()
.unwrap(),
)
.with_hash(&hasher.try_build().unwrap())
.try_build_legacy_encoded()
.unwrap();
let s = v0.to_string();
Expand All @@ -402,14 +393,11 @@ mod tests {

#[test]
fn test_v1() {
let mut hasher = mh::Builder::new(Codec::Sha3512).unwrap();
hasher.update(b"for great justice, move every zig!");
let v1 = Builder::new(Codec::Cidv1)
.with_target_codec(Codec::DagCbor)
.with_hash(
&mh::Builder::new_from_bytes(Codec::Sha3512, b"for great justice, move every zig!")
.unwrap()
.try_build()
.unwrap(),
)
.with_hash(&hasher.try_build().unwrap())
.try_build()
.unwrap();

Expand All @@ -420,14 +408,11 @@ mod tests {

#[test]
fn test_v1_binary_roundtrip() {
let mut hasher = mh::Builder::new(Codec::Sha3512).unwrap();
hasher.update(b"for great justice, move every zig!");
let v1 = Builder::new(Codec::Cidv1)
.with_target_codec(Codec::DagCbor)
.with_hash(
&mh::Builder::new_from_bytes(Codec::Sha3512, b"for great justice, move every zig!")
.unwrap()
.try_build()
.unwrap(),
)
.with_hash(&hasher.try_build().unwrap())
.try_build()
.unwrap();
let v: Vec<u8> = v1.clone().into();
Expand All @@ -436,15 +421,12 @@ mod tests {

#[test]
fn test_v1_encoded_roundtrip() {
let mut hasher = mh::Builder::new(Codec::Sha3256).unwrap();
hasher.update(b"for great justice, move every zig!");
let v1 = Builder::new(Codec::Cidv1)
.with_target_codec(Codec::DagCbor)
.with_base_encoding(Base::Base32Lower)
.with_hash(
&mh::Builder::new_from_bytes(Codec::Sha3256, b"for great justice, move every zig!")
.unwrap()
.try_build()
.unwrap(),
)
.with_hash(&hasher.try_build().unwrap())
.try_build_encoded()
.unwrap();
let s = v1.to_string();
Expand Down
21 changes: 9 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
//! use multi_hash::Builder as MhBuilder;
//!
//! // Create a multihash
//! let hash = MhBuilder::new_from_bytes(Codec::Sha2256, b"hello world")
//! .unwrap()
//! .try_build()
//! .unwrap();
//! let mut hasher = MhBuilder::new(Codec::Sha2256).unwrap();
//! hasher.update(b"hello world");
//! let hash = hasher.try_build().unwrap();
//!
//! // Create a CID v1
//! let cid = cid::Builder::new(Codec::Sha2256)
Expand All @@ -49,10 +48,9 @@
//! use multi_codec::Codec;
//! use multi_hash::Builder as MhBuilder;
//!
//! let hash = MhBuilder::new_from_bytes(Codec::Sha2256, b"data")
//! .unwrap()
//! .try_build()
//! .unwrap();
//! let mut hasher = MhBuilder::new(Codec::Sha2256).unwrap();
//! hasher.update(b"data");
//! let hash = hasher.try_build().unwrap();
//!
//! let cid = cid::Builder::new(Codec::Sha2256)
//! .with_target_codec(Codec::DagCbor)
Expand Down Expand Up @@ -107,10 +105,9 @@ pub mod serde;
/// use multi_cid::prelude::*;
/// use multi_hash::Builder as MhBuilder;
///
/// let hash = MhBuilder::new_from_bytes(Codec::Sha2256, b"test")
/// .unwrap()
/// .try_build()
/// .unwrap();
/// let mut hasher = MhBuilder::new(Codec::Sha2256).unwrap();
/// hasher.update(b"test");
/// let hash = hasher.try_build().unwrap();
/// let cid = cid::Builder::new(Codec::Sha2256)
/// .with_target_codec(Codec::DagCbor)
/// .with_hash(&hash)
Expand Down
Loading
Loading