Function Reference

ssdeep_fuzzy_hash

ssdeep_fuzzy_hash(to_hash)

Calculates an ssdeep fuzzy hash for the supplied string.

Parameters:to_hash (string) – The string to create a hash from - should be 4kb or greater in size
Return type:string

Warning

These files should contain at least 4 kilobytes of text for an accurate hash to be created. The is a restriction of the fuzzy hashing algorithm itself and not lib_mysqludf_ssdeep.

I have had success with hashes taken from text with just 250 characters though so your mileage may vary.

Example

SELECT ssdeep_fuzzy_hash('A 4kb string would go here.');

ssdeep_fuzzy_hash_filename

ssdeep_fuzzy_hash_filename(file_name)

Calculates an ssdeep fuzzy hash from the supplied file path.

Parameters:file_name (string) – The path to a file on disk to create a hash from
Return type:string

Warning

These files should contain at least 4 kilobytes of text for an accurate hash to be created. The is a restriction of the fuzzy hashing algorithm itself and not lib_mysqludf_ssdeep.

I have had success with hashes taken from text with just 250 characters though so your mileage may vary.

Example

SELECT ssdeep_fuzzy_hash_filename('/tmp/file.txt');

ssdeep_fuzzy_compare

ssdeep_fuzzy_compare(signature1, signature2)

Calculates match percentage between two hash strings.

Parameters:
  • signature1 (string) – ssdeep hash to compare
  • signature2 (string) – ssdeep hash to compare
Returns:

0 to 100 on success and null otherwise.

Return type:

integer or null

Example

SELECT ssdeep_fuzzy_compare('384:eGWhC3Uvw60bolB5EqQWXVyBp5ZXHqDj2Gub:mYUvywB620rZPh', '48:H46piMWRaKuCghtYCzHq2nzu50mAmyyGl7A/eIMTQySmmf2ysIX3zxPZ:H46I4tYCb9xmyyGlsMT9Smg2ysUZ');

lib_mysqludf_ssdeep_info

lib_mysqludf_ssdeep_info()

This function will return the version number of the UDF.

Return type:string

Example

SELECT lib_mysqludf_ssdeep_info();