esphome/esphome/dashboard/util.py
Otto Winter c030be4d3f
Fix dashboard logout button and py3.8 removed hmac.new digestmod (#1156)
* Fix dashboard logout button and py3.8 removed hmac.new digestmod

* Just use SHA256

No reason to use HMAC here, as authenticity is not an issue

* Wrong branch

* Clenaup
2020-07-24 11:10:09 +02:00

9 lines
285 B
Python

import hashlib
def password_hash(password: str) -> bytes:
"""Create a hash of a password to transform it to a fixed-length digest.
Note this is not meant for secure storage, but for securely comparing passwords.
"""
return hashlib.sha256(password.encode()).digest()