slahasher 0.5.0

Hashing functions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::Hash;
use base_xx::ByteVec;
use base_xx::SerialiseError;
use std::sync::Arc;

/// A hash function implementation.
pub trait Hasher {
    /// Computes a hash of the provided bytes.
    ///
    /// # Errors
    /// * `SerialiseError` - If hashing fails (for example, due to an error converting the input
    ///   bytes to the internal hash representation)
    fn try_hash(byte_vec: Arc<ByteVec>) -> Result<Arc<Hash>, SerialiseError>;
}