Module: Ssdeep

Defined in:
ext/ssdeep_native/ssdeep_native.c

Defined Under Namespace

Classes: HashError

Constant Summary

FUZZY_MAX_RESULT =
INT2NUM(FUZZY_MAX_RESULT)
SPAMSUM_LENGTH =
INT2NUM(SPAMSUM_LENGTH)

Class Method Summary (collapse)

Class Method Details

+ (Object) compare(sig1, sig2)

Compare two hashes

Parameters:

  • String

    sig1 A fuzzy hash which will be compared to sig2

  • String

    sig2 A fuzzy hash which will be compared to sig1

Returns:

  • Integer A value between 0 and 100 indicating the percentage of similarity.



# File 'ext/ssdeep_native/ssdeep_native.c'

/* call-seq: compare(sig1, sig2)
 *
 * Compare two hashes
 *
 * @param String sig1  A fuzzy hash which will be compared to sig2
 *
 * @param String sig2  A fuzzy hash which will be compared to sig1
 *
 * @return Integer
 *   A value between 0 and 100 indicating the percentage of similarity.
 */
VALUE ssdeep_compare(VALUE klass, VALUE sig1, VALUE sig2) 

+ (Object) from_file(filename)

Create a fuzzy hash from a file

Parameters:

  • String

    fielname The file to read and hash

Returns:

  • String The fuzzy hash of the file input

Raises:

  • HashError An exception is raised if the libfuzzy library encounters an error.



# File 'ext/ssdeep_native/ssdeep_native.c'

/* call-seq: from_file(filename)
 *
 * Create a fuzzy hash from a file
 *
 * @param  String fielname  The file to read and hash
 *
 * @return String           The fuzzy hash of the file input
 *
 * @raise HashError  
 *   An exception is raised if the libfuzzy library encounters an error.
 */
VALUE ssdeep_from_filename(VALUE klass, VALUE filename) 

+ (Object) from_fileno(fileno)

Create a fuzzy hash from a file descriptor fileno

Parameters:

  • Integer

    fileno The file descriptor to read and hash

Returns:

  • String The fuzzy hash of the file descriptor input

Raises:

  • HashError An exception is raised if the libfuzzy library encounters an error.



# File 'ext/ssdeep_native/ssdeep_native.c'

/* call-seq: from_fileno(fileno)
 *
 * Create a fuzzy hash from a file descriptor fileno
 *
 * @param  Integer fileno  The file descriptor to read and hash
 * 
 * @return String          The fuzzy hash of the file descriptor input
 *
 * @raise HashError  
 *   An exception is raised if the libfuzzy library encounters an error.
 */
VALUE ssdeep_from_fileno(VALUE klass, VALUE fileno) 

+ (Object) from_string(buf)

Create a fuzzy hash from a ruby string

Parameters:

  • String

    buf The string to hash

Returns:

  • String The fuzzy hash of the string

Raises:

  • HashError An exception is raised if the libfuzzy library encounters an error.



# File 'ext/ssdeep_native/ssdeep_native.c'

/* call-seq: from_string(buf)
 *
 * Create a fuzzy hash from a ruby string
 *
 * @param  String buf   The string to hash
 *
 * @return String       The fuzzy hash of the string
 *
 * @raise HashError  
 *   An exception is raised if the libfuzzy library encounters an error.
 */
VALUE ssdeep_from_string(VALUE klass, VALUE buf)