mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-02 17:30:18 +00:00
Testing with SHA1 gives positive results, also changed the truncation rule
This commit is contained in:
parent
f0a8aa02a9
commit
f66bca67ac
@ -34,4 +34,9 @@ def create_hash(*args: str, decode=False, limit=10) -> str:
|
||||
str_ = str_.encode("utf-8")
|
||||
str_ = hashlib.sha1(str_).hexdigest()
|
||||
# REVIEW Switched to sha1 hashlib.sha256(str_).hexdigest()
|
||||
return str_[-limit:]
|
||||
|
||||
# REVIEW Take the first limit/2 and last limit/2 characters
|
||||
# This is to avoid collisions
|
||||
return str_[:limit // 2] + str_[-limit // 2:] if limit % 2 == 0 else str_[:limit // 2] + str_[-limit // 2 - 1:]
|
||||
|
||||
# return str_[-limit:]
|
||||
|
Loading…
x
Reference in New Issue
Block a user