rust-multihash icon indicating copy to clipboard operation
rust-multihash copied to clipboard

How to get the code of a format?

Open matthiasbeyer opened this issue 5 months ago • 1 comments

From the docs I cannot find a getter for the code of any multihash code format (as in Multihash::code()).

The docs define a const for Sha3_256 but that's it.

matthiasbeyer avatar Oct 03 '25 08:10 matthiasbeyer

The hashers were moved to multihash-codetable. There you can use the Code enum, from there you can e.g. get an u64 from the Code.

Though, it's recommended that you implement for your use case your own Code enum with the help of multihash-derive.

vmx avatar Oct 13 '25 11:10 vmx