diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-18 16:28:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-18 16:28:48 +0100 |
commit | b352a4cad40124bf371b4389bb35c6696a39b6d2 (patch) | |
tree | af7f9dd3ee59af85a6cb865c3d89c9dafb2ba96b /lualib | |
parent | 4cf646a8e557c0e6a37f5cdd354486fcc00a5689 (diff) | |
download | rspamd-b352a4cad40124bf371b4389bb35c6696a39b6d2.tar.gz rspamd-b352a4cad40124bf371b4389bb35c6696a39b6d2.zip |
[Minor] Improve `hash` processor
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_selectors.lua | 7 |
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', }, |