commit 0d4bf7e: [Minor] Add xxh3 support to lua_cryptobox
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Dec 5 18:28:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-12-05 18:18:38 +0000
URL: https://github.com/rspamd/rspamd/commit/0d4bf7ef10f5c93f3f0ee828d353bb9da2c27d48
[Minor] Add xxh3 support to lua_cryptobox
---
src/lua/lua_cryptobox.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c
index 7d1b8e4a9..7c19a7805 100644
--- a/src/lua/lua_cryptobox.c
+++ b/src/lua/lua_cryptobox.c
@@ -45,6 +45,7 @@ enum lua_cryptobox_hash_type {
LUA_CRYPTOBOX_HASH_HMAC,
LUA_CRYPTOBOX_HASH_XXHASH64,
LUA_CRYPTOBOX_HASH_XXHASH32,
+ LUA_CRYPTOBOX_HASH_XXHASH3,
LUA_CRYPTOBOX_HASH_MUM,
LUA_CRYPTOBOX_HASH_T1HA,
};
@@ -977,6 +978,7 @@ rspamd_lua_hash_update (struct rspamd_lua_cryptobox_hash *h,
break;
case LUA_CRYPTOBOX_HASH_XXHASH64:
case LUA_CRYPTOBOX_HASH_XXHASH32:
+ case LUA_CRYPTOBOX_HASH_XXHASH3:
case LUA_CRYPTOBOX_HASH_MUM:
case LUA_CRYPTOBOX_HASH_T1HA:
rspamd_cryptobox_fast_hash_update (h->content.fh, p, len);
@@ -1140,6 +1142,13 @@ rspamd_lua_hash_create (const gchar *type, const gchar *key, gsize keylen)
RSPAMD_CRYPTOBOX_XXHASH32, 0);
h->out_len = sizeof (guint32);
}
+ else if (g_ascii_strcasecmp (type, "xxh3") == 0) {
+ h->type = LUA_CRYPTOBOX_HASH_XXHASH3;
+ h->content.fh = rspamd_cryptobox_fast_hash_new ();
+ rspamd_cryptobox_fast_hash_init_specific (h->content.fh,
+ RSPAMD_CRYPTOBOX_XXHASH3, 0);
+ h->out_len = sizeof (guint64);
+ }
else if (g_ascii_strcasecmp (type, "mum") == 0) {
h->type = LUA_CRYPTOBOX_HASH_MUM;
h->content.fh = rspamd_cryptobox_fast_hash_new ();
@@ -1467,6 +1476,10 @@ lua_cryptobox_hash_reset (lua_State *L)
rspamd_cryptobox_fast_hash_init_specific (h->content.fh,
RSPAMD_CRYPTOBOX_XXHASH32, 0);
break;
+ case LUA_CRYPTOBOX_HASH_XXHASH3:
+ rspamd_cryptobox_fast_hash_init_specific (h->content.fh,
+ RSPAMD_CRYPTOBOX_XXHASH3, 0);
+ break;
case LUA_CRYPTOBOX_HASH_MUM:
rspamd_cryptobox_fast_hash_init_specific (h->content.fh,
RSPAMD_CRYPTOBOX_MUMHASH, 0);
@@ -1518,6 +1531,7 @@ lua_cryptobox_hash_finish (struct rspamd_lua_cryptobox_hash *h)
break;
case LUA_CRYPTOBOX_HASH_XXHASH64:
case LUA_CRYPTOBOX_HASH_XXHASH32:
+ case LUA_CRYPTOBOX_HASH_XXHASH3:
case LUA_CRYPTOBOX_HASH_MUM:
case LUA_CRYPTOBOX_HASH_T1HA:
ll = rspamd_cryptobox_fast_hash_final (h->content.fh);
More information about the Commits
mailing list