pub struct Hasher { /* private fields */ }Expand description
Streaming hasher for computing document and file hashes.
Implementations§
Source§impl Hasher
impl Hasher
Sourcepub fn new(algorithm: HashAlgorithm) -> Self
pub fn new(algorithm: HashAlgorithm) -> Self
Create a new hasher with the specified algorithm.
Sourcepub fn default_algorithm() -> Self
pub fn default_algorithm() -> Self
Create a new hasher with the default algorithm (SHA-256).
Sourcepub fn finalize(self) -> DocumentId
pub fn finalize(self) -> DocumentId
Finalize the hash and return the document ID.
Sourcepub fn hash(algorithm: HashAlgorithm, data: &[u8]) -> DocumentId
pub fn hash(algorithm: HashAlgorithm, data: &[u8]) -> DocumentId
Hash data in one shot.
Sourcepub fn hash_reader<R: Read>(
algorithm: HashAlgorithm,
reader: &mut R,
) -> Result<DocumentId>
pub fn hash_reader<R: Read>( algorithm: HashAlgorithm, reader: &mut R, ) -> Result<DocumentId>
Auto Trait Implementations§
impl Freeze for Hasher
impl RefUnwindSafe for Hasher
impl Send for Hasher
impl Sync for Hasher
impl Unpin for Hasher
impl UnsafeUnpin for Hasher
impl UnwindSafe for Hasher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more