From cfd2ad6b57258c7b5d26e642f7f2f2536a8fa6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sat, 19 Oct 2024 20:51:19 +0200 Subject: [PATCH] Small comment added to hash.py. Note that we use sha256 as hasing function on all "db storeables" items (such as cache or storage). The probability of clash with the low length keys that we use is, basically, 0, and it's fine this way. Althouth there is faster hashing methods, the los usage and the db itself maky insignificant if it's faster or not --- server/src/uds/core/util/hash.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/uds/core/util/hash.py b/server/src/uds/core/util/hash.py index 58073609f..9d47bc93a 100644 --- a/server/src/uds/core/util/hash.py +++ b/server/src/uds/core/util/hash.py @@ -46,6 +46,9 @@ def hash_key(key: typing.Union[str, bytes]) -> str: Note that replacing the algorithm used here will force to invalidate all previous generated entries. In the case of cache, this is not a problem, but in other cases, it could be. + + Currently, we are using sha256, that generates a 64 bytes long hash + Blake2b is also a good candidate """ if isinstance(key, str): key = key.encode('utf-8')