Generate event ID as true random strings, not MD5 hashes of UUIDs

This commit is contained in:
Fabio Manganiello 2022-09-05 03:05:22 +02:00
parent c77746e278
commit 41acf4b253
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -1,10 +1,9 @@
import copy import copy
import hashlib
import json import json
import random
import re import re
import sys import sys
import time import time
import uuid
from datetime import date from datetime import date
@ -79,9 +78,7 @@ class Event(Message):
@staticmethod @staticmethod
def _generate_id(): def _generate_id():
"""Generate a unique event ID""" """Generate a unique event ID"""
return hashlib.md5( return ''.join(['{:02x}'.format(random.randint(0, 255)) for _ in range(16)])
str(uuid.uuid1()).encode()
).hexdigest() # lgtm [py/weak-sensitive-data-hashing]
def matches_condition(self, condition): def matches_condition(self, condition):
""" """