Function ssdeep::hash [] [src]

pub fn hash(buf: &[u8]) -> Option<String>

Computes the fuzzy hash of a buffer.

Returns the fuzzy hash of the given buffer. When an error occurs, it returns None.

Examples

let h = ssdeep::hash(b"Hello there!").unwrap();
assert_eq!(h, "3:aNRn:aNRn");

Panics

If the size of the buffer is strictly greater than 2^32 - 1 bytes. The reason for this is that the corresponding function from the underlying C library accepts the length of the buffer as an unsigned 32b integer.

Implementation details

Internally, it calls the fuzzy_hash_buf() function from the underlying C library. A non-zero return value is translated into None.