Function ssdeep::hash_from_file
[−]
[src]
pub fn hash_from_file<P: AsRef<Path>>(file_path: P) -> Option<String>
Computes the fuzzy hash of a file.
Returns the fuzzy hash of the given file. When an error occurs, it returns
None
.
Examples
let h = ssdeep::hash_from_file("tests/file.txt").unwrap(); assert_eq!(h, "48:9MABzSwnjpDeSrLp8+nagE4f3ZMvcDT0MIhqy6Ic:9XMwnjdeSHS+n5ZfScX0MJ7");
Panics
If the path to the file cannot be converted into bytes or it contains a null byte.
Implementation details
Internally, it calls the fuzzy_hash_filename()
function from the
underlying C library. A non-zero return value is translated into None
.