Function multihash::decode
[−]
[src]
pub fn decode(input: &[u8]) -> Result<Multihash>
Decodes bytes into a multihash
Errors
Returns an error if the bytes are not a valid multihash.
Examples
use multihash::{decode, HashTypes, Multihash}; // use the data from the `encode` example let data = vec![18, 32, 185, 77, 39, 185, 147, 77, 62, 8, 165, 46, 82, 215, 218, 125, 171, 250, 196, 132, 239, 227, 122, 83, 128, 238, 144, 136, 247, 172, 226, 239, 205, 233]; assert_eq!( decode(&data).unwrap(), Multihash { alg: HashTypes::SHA2256, digest: &data[2..] } );