]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve `hash` processor
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Sep 2018 15:28:48 +0000 (16:28 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Sep 2018 15:28:48 +0000 (16:28 +0100)
lualib/lua_selectors.lua

index 3460f1f291bbace252dca8146c5bfb7fd446432d..197d9c53e8b8e883d9ae869af789fbaa08004f22 100644 (file)
@@ -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',
   },