From b352a4cad40124bf371b4389bb35c6696a39b6d2 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 18 Sep 2018 16:28:48 +0100 Subject: [PATCH] [Minor] Improve `hash` processor --- lualib/lua_selectors.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 3460f1f291..197d9c53e8 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', }, -- 2.47.3