Function multihash::encode
[−]
[src]
pub fn encode(wanttype: HashTypes, input: &[u8]) -> Result<Vec<u8>>
Encodes data into a multihash.
The returned data is raw bytes. To make is more human-friendly, you can encode it (hex, base58, base64, etc).
Errors
Will return an error if the specified hash type is not supported. See the docs for HashTypes
to see what is supported.
Examples
use multihash::{encode, HashTypes}; assert_eq!( encode(HashTypes::SHA2256, "hello world".as_bytes()).unwrap(), 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] );