35 #ifndef FFUZZY_FFUZZY_H
36 #define FFUZZY_FFUZZY_H
61 #define FFUZZY_SPAMSUM_LENGTH 64
64 #define FFUZZY_MIN_BLOCKSIZE 3
70 #define FFUZZY_MIN_MATCH 7
660 const char *s1,
size_t s1len,
661 const char *s2,
size_t s2len,
662 unsigned long block_size
int ffuzzy_compare_digest_near_lt(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two fuzzy hashes assuming second block size is double as first one.
int ffuzzy_digestcmp(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two ffuzzy_digest values.
int ffuzzy_compare_digest(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two fuzzy hashes and compute similarity score.
bool ffuzzy_blocksize_is_near(unsigned long block_size1, unsigned long block_size2)
Determines whether given block sizes are "near".
int ffuzzy_score_strings(const char *s1, size_t s1len, const char *s2, size_t s2len, unsigned long block_size)
Compute partial similarity score for given two block strings and block size.
void ffuzzy_convert_digest_to_udigest(ffuzzy_udigest *udigest, const ffuzzy_digest *digest)
Convert ffuzzy_digest to ffuzzy_udigest.
#define FFUZZY_SPAMSUM_LENGTH
Maximum length for the digest block.
Definition: ffuzzy.h:61
int ffuzzy_score_cap(int s1len, int s2len, unsigned long block_size)
Retrieve score cap for given block lengths and the block size.
int ffuzzy_digestcmp_blocksize_n(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two ffuzzy_digest values by whether block sizes are "natural" and block size values...
int ffuzzy_compare(const char *str1, const char *str2)
Compute similarity score for given ssdeep hash strings.
bool ffuzzy_read_udigest(ffuzzy_udigest *udigest, const char *s)
Read unnormalized ssdeep digest from the string.
The type to store unnormalized ssdeep digest after parsing.
Definition: ffuzzy.h:462
unsigned long block_size
Block size of the ssdeep digest.
Definition: ffuzzy.h:465
int ffuzzy_score_cap_1(int minslen, unsigned long block_size)
Retrieve score cap for given block length and size.
bool ffuzzy_blocksize_is_far_le(unsigned long block_size1, unsigned long block_size2)
Determines whether given ordered block sizes "far" enough.
int ffuzzy_compare_digest_near(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two fuzzy hashes assuming two block sizes of given hashes are "near".
bool ffuzzy_blocksize_is_valid(unsigned long block_size)
Determines whether given block size is valid to use in libffuzzy.
bool ffuzzy_pretty_digest(char *buf, size_t buflen, const ffuzzy_digest *digest)
Convert ffuzzy_digest to the string.
The type to store ssdeep digest after parsing.
Definition: ffuzzy.h:113
bool ffuzzy_udigest_is_valid_lengths(const ffuzzy_udigest *udigest)
Determines whether block lengths of given digest are valid.
bool ffuzzy_udigest_is_natural_buffer(const ffuzzy_udigest *udigest)
Determines whether digest blocks are "natural".
size_t len2
Digest length for second block of the digest.
Definition: ffuzzy.h:464
bool ffuzzy_pretty_udigest(char *buf, size_t buflen, const ffuzzy_udigest *udigest)
Convert ffuzzy_udigest to the string.
bool ffuzzy_digest_is_natural_buffer(const ffuzzy_digest *digest)
Determines whether digest blocks are valid and "natural".
void ffuzzy_convert_udigest_to_digest(ffuzzy_digest *digest, const ffuzzy_udigest *udigest)
Convert ffuzzy_udigest to ffuzzy_digest.
int ffuzzy_udigestcmp(const ffuzzy_udigest *d1, const ffuzzy_udigest *d2)
Compare two ffuzzy_udigest values.
bool ffuzzy_digest_is_valid_lengths(const ffuzzy_digest *digest)
Determines whether block lengths of given digest are valid.
size_t len2
Digest length for second block of the digest.
Definition: ffuzzy.h:115
int ffuzzy_udigestcmp_blocksize_n(const ffuzzy_udigest *d1, const ffuzzy_udigest *d2)
Compare two ffuzzy_udigest values by whether block sizes are "natural" and block size values...
bool ffuzzy_udigest_is_valid(const ffuzzy_udigest *udigest)
Determines whether given digest is valid.
bool ffuzzy_digest_is_valid_buffer(const ffuzzy_digest *digest)
Determines whether digest blocks are valid.
bool ffuzzy_udigest_is_natural(const ffuzzy_udigest *udigest)
Determines whether given digest is valid and "natural".
int ffuzzy_compare_digest_near_eq(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two fuzzy hashes assuming two block sizes are same.
unsigned long block_size
Block size of the ssdeep digest.
Definition: ffuzzy.h:116
bool ffuzzy_read_digest(ffuzzy_digest *digest, const char *s)
Read ssdeep digest from the string.
int ffuzzy_digestcmp_blocksize(const ffuzzy_digest *d1, const ffuzzy_digest *d2)
Compare two ffuzzy_digest values by block sizes.
bool ffuzzy_blocksize_is_natural(unsigned long block_size)
Determines whether given block size is "natural".
int ffuzzy_udigestcmp_blocksize(const ffuzzy_udigest *d1, const ffuzzy_udigest *d2)
Compare two ffuzzy_udigest values by block sizes.
bool ffuzzy_digest_is_natural(const ffuzzy_digest *digest)
Determines whether given digest is valid and "natural".
bool ffuzzy_digest_is_valid(const ffuzzy_digest *digest)
Determines whether given digest is valid.