Function digest_from_reader
pub fn digest_from_reader(
reader: impl Read,
) -> Result<Digest, UnknownCryptoError> ⓘ
dep_orion
only.Expand description
Hash data from a Read
` type using BLAKE2b-256.
See the module-level docs for an example of how to use this function.
Internally calls std::io::copy
to move data from the reader into the Blake2b writer.
Note that the std::io::copy
function buffers reads, so passing in a
BufReader
may be unnecessary.
For lower-level control over reads, writes, buffer sizes, etc., consider using the
Blake2b
type and its
Write
implementation directly. See Blake2b
’s Write
implementation
and/or its Write
documentation for an example.
§Errors:
This function will only ever return the std::io::ErrorKind::Other
variant when it returns an error. Additionally, this will always contain Orion’s
UnknownCryptoError
type.
Note that if an error is returned, data may still have been consumed from the given reader.