From: Vsevolod Stakhov Date: Tue, 18 Sep 2018 15:28:48 +0000 (+0100) Subject: [Minor] Improve `hash` processor X-Git-Tag: 1.8.0~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b352a4cad40124bf371b4389bb35c6696a39b6d2;p=rspamd.git [Minor] Improve `hash` processor --- diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 3460f1f29..197d9c53e 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -412,7 +412,12 @@ local transform_function = { ['process'] = function(inp, _, args) local hash = require 'rspamd_cryptobox_hash' local ht = args[1] or 'blake2' - return hash:create_specific(ht):update(inp), 'hash' + local h = hash:create_specific(ht):update(inp) + + if args[2] then + return h[args[2]](h),'string' -- Call hash method + end + return h, 'hash' end, ['description'] = 'Create a digest from string or a list of strings', },