status-desktop/scripts/common/PasswordFunctions.py
Igor Sirotin 5b5361c9b0
feat(scripts): simple python script to interact with database (#11184)
* fix(scripts): fix `password-hash.py`
2023-06-20 18:27:47 +03:00

8 lines
254 B
Python

from Crypto.Hash import keccak
def hash_password(password, old_desktop=False):
hasher = keccak.new(digest_bits=256)
hasher.update(password.encode())
hash = hasher.hexdigest()
return '0x' + (hash.upper() if old_desktop else hash.lower())