1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

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
This commit is contained in:
Adolfo Gómez García 2024-10-19 20:51:19 +02:00
parent 1e893240cd
commit cfd2ad6b57
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -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')