From 07f1fff125c66fbbd0ebbc51fe18e68d1db4af6d Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 18 Aug 2022 07:20:30 +0100 Subject: [PATCH] Switch to siphash --- docker/requirements.prod.txt | 2 +- requirements.txt | 2 +- utils/dedup.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/requirements.prod.txt b/docker/requirements.prod.txt index 5f94628..90c5a96 100644 --- a/docker/requirements.prod.txt +++ b/docker/requirements.prod.txt @@ -5,5 +5,5 @@ redis pyYaML python-logstash service_identity -csiphash +siphashc Klein diff --git a/requirements.txt b/requirements.txt index f6a2dcf..7dbea1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ redis pyYaML python-logstash service_identity -csiphash +siphashc Klein diff --git a/utils/dedup.py b/utils/dedup.py index 0565a0d..b4c44e3 100644 --- a/utils/dedup.py +++ b/utils/dedup.py @@ -2,7 +2,7 @@ from copy import deepcopy from datetime import datetime from json import dumps -from csiphash import siphash24 +from siphashc import siphash import main from utils.logging.debug import debug @@ -13,7 +13,7 @@ def dedup(numName, b): if "ts" in c.keys(): del c["ts"] c["approxtime"] = str(datetime.utcnow().timestamp())[: main.config["Tweaks"]["DedupPrecision"]] - castHash = siphash24(main.hashKey, dumps(c, sort_keys=True).encode("utf-8")) + castHash = siphash(main.hashKey, dumps(c, sort_keys=True)) del c["approxtime"] isDuplicate = any(castHash in main.lastEvents[x] for x in main.lastEvents.keys() if not x == numName) if isDuplicate: