[][src]Crate bao

RepoCrateSpec

This crate implements the Bao hash function and encoding format. The bao command line utility is built on top of it. For more about how Bao works and what the encoding format is doing, see the command line readme and the full specification.

The encode and decode modules require the std feature, which is enabled by default.

Caution! Not yet suitable for production use. The output of Bao isn't stable. There might be more changes before 1.0.

Example

let expected = "6d1128fa367a8d7f6f8dc946ede523e61b881a8b3463014520ad946dad75f820";
let hash = bao::hash::hash(b"input bytes");
assert_eq!(expected, &hash.to_hex());

let mut hasher = bao::hash::Hasher::new();
hasher.update(b"input");
hasher.update(b" ");
hasher.update(b"bytes");
assert_eq!(hash, hasher.finalize());

Modules

decode

Decode the Bao format, or decode a slice.

encode

Encode some input bytes into the Bao format, or slice an existing encoding.

hash

Compute a Bao hash from some input bytes.