- make Serde (de)serialization no_std compatible (#337) (7ad5161), closes 336#. This was a regression introduced in v0.19.0.
- the Serde serialization format changed
- split crates into multiple to isolate breaking changes
identity
hasher was removed
See the migration section below for help on upgrading.
- codetable: remove
identity
hasher (#289) (8473e2f) - Serde serialize Multihash in bytes representation (#302) (1023226)
- avoid possible panic in error handling code (#277) (5dc1dfa)
- don't panic on non minimal varints (#291) (6ef6040), closes #282
- expose
MultihashDigest
trait in codetable (#304) (50b43cd)
When upgrading to v0.19
, consider the following:
-
Code
has moved frommultihash::Code
tomultihash_codetable::Code
. It's strongly recommended to define your own code table usingmultihash_derive
. Check the custom codetable example on how to use it. For the simplest migration, use themultihash_codetable::Code
.Before
use multihash::{Code, MultihashDigest}; fn main() { let hash = Code::Sha2_256.digest(b"hello, world!"); println!("{:?}", hash); }
After
use multihash_codetable::{Code, MultihashDigest}; fn main() { let hash = Code::Sha2_256.digest(b"hello, world!"); println!("{:?}", hash); }
If you get compile errors, make sure you have the correct features enabled. In this case it would be the
sha2
anddigest
features. -
multihash::Multihash
now requires the size of its internal buffer as a const-generic. You can migrate your existing code by defining the following type-alias:type Multihash = multihash::Multihash<64>;
-
The
identity
hasher has been removed completely.Before
use multihash::{Code, MultihashDigest}; fn main() { let hash = Code::Identity.digest(b"hello, world!"); println!("{:?}", hash); }
After
use multihash::Multihash; const IDENTITY_HASH_CODE: u64 = 0x00; fn main() { let hash = Multihash::<64>::wrap(IDENTITY_HASH_CODE, b"hello, world!").unwrap(); println!("{:?}", hash); }
Check the identity example for more information on how to replicate the functionality.
v0.18.1 (2023-04-14)
0.18.0 (2022-12-06)
-
update to Rust edition 2021
-
Multihash::write()
returns bytes writtenPrior to this change it returned an empty tuple
()
, now it returns the bytes written.