[−][src]Crate bao
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 project 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(b"input bytes"); assert_eq!(expected, &hash.to_hex()); let mut hasher = bao::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. |
Structs
Hash | A Bao hash, with constant-time equality. |
Hasher | An incremental hasher. |
Constants
BUF_SIZE | An efficient buffer size for |
HASH_SIZE | The size of a |
Functions
copy | Copies the entire contents of a reader into a writer, just like
|
hash | Hash a slice of input bytes all at once. If the |