14 lines
423 B
Python
14 lines
423 B
Python
from hashlib import blake2b
|
|
|
|
def hash_token(token, secret, salt):
|
|
# first iteration
|
|
h1 = blake2b(digest_size=32)
|
|
h1.update((token + secret + salt).encode("utf-8"))
|
|
hash1 = h1.digest()
|
|
# second iteration
|
|
h2 = blake2b(digest_size=32)
|
|
h2.update(hash1)
|
|
return h2.hexdigest().lower()
|
|
|
|
print(hash_token("my-test-token", "local_dev_secret_change_for_production_12345678901234567890", "testgroup"))
|