From: Vsevolod Stakhov Date: Tue, 6 Dec 2016 18:07:40 +0000 (+0000) Subject: [Feature] Use normalized images in fuzzy hashes X-Git-Tag: 1.5.0~656 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22f8a1e66c19254516453b53fc38c699c673f3f5;p=thirdparty%2Frspamd.git [Feature] Use normalized images in fuzzy hashes --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 507d224ccc..e3ccd814d9 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2128,6 +2128,22 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule, if (io) { g_ptr_array_add (res, io); } + + if (image->normalized_data) { + guchar norm_digest[rspamd_cryptobox_HASHBYTES]; + + rspamd_cryptobox_hash (norm_digest, + image->normalized_data->data, + image->normalized_data->len * sizeof (gint), + NULL, 0); + /* TODO: add shingles here */ + io = fuzzy_cmd_from_data_part (rule, c, flag, value, + task->task_pool, + norm_digest); + if (io) { + g_ptr_array_add (res, io); + } + } } } }