diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-06 18:07:40 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-06 18:07:40 +0000 |
commit | 22f8a1e66c19254516453b53fc38c699c673f3f5 (patch) | |
tree | 5b719545dcd42762287e9c3e91e5bc4e15260451 /src/plugins | |
parent | e8d00fedfe7e0c5e306178499c64aaa697c34639 (diff) | |
download | rspamd-22f8a1e66c19254516453b53fc38c699c673f3f5.tar.gz rspamd-22f8a1e66c19254516453b53fc38c699c673f3f5.zip |
[Feature] Use normalized images in fuzzy hashes
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/fuzzy_check.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 507d224cc..e3ccd814d 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); + } + } } } } |