summaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-18 16:28:48 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-18 16:28:48 +0100
commitb352a4cad40124bf371b4389bb35c6696a39b6d2 (patch)
treeaf7f9dd3ee59af85a6cb865c3d89c9dafb2ba96b /lualib/lua_selectors.lua
parent4cf646a8e557c0e6a37f5cdd354486fcc00a5689 (diff)
downloadrspamd-b352a4cad40124bf371b4389bb35c6696a39b6d2.tar.gz
rspamd-b352a4cad40124bf371b4389bb35c6696a39b6d2.zip
[Minor] Improve `hash` processor
Diffstat (limited to 'lualib/lua_selectors.lua')
-rw-r--r--lualib/lua_selectors.lua7
1 files changed, 6 insertions, 1 deletions
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',
},