Function ssdeep::hash_stream

source ·
pub fn hash_stream<R: Read>(
    reader: &mut R
) -> Result<RawFuzzyHash, GeneratorOrIOError>
Available on crate features std and easy-functions only.
Expand description

Generates a fuzzy hash from a given reader stream.

Example

use std::error::Error;
use std::fs::File;

fn main() -> Result<(), ssdeep::GeneratorOrIOError> {
    let mut stream = File::open("data/examples/hello.txt")?;
    let fuzzy_hash = ssdeep::hash_stream(&mut stream)?;
    let fuzzy_hash_str = fuzzy_hash.to_string();
    assert_eq!(fuzzy_hash_str, "3:aaX8v:aV");
    Ok(())
}