replace crypt with hashlib

This commit is contained in:
Christian Hagenest
2024-06-06 00:05:40 +02:00
committed by missytake
parent 6b59b8be44
commit 9be0408ab8

View File

@@ -1,4 +1,4 @@
import crypt import hashlib
import json import json
import logging import logging
import os import os
@@ -23,7 +23,7 @@ class UnknownCommand(ValueError):
def encrypt_password(password: str): def encrypt_password(password: str):
# https://doc.dovecot.org/configuration_manual/authentication/password_schemes/ # https://doc.dovecot.org/configuration_manual/authentication/password_schemes/
passhash = crypt.crypt(password, crypt.METHOD_SHA512) passhash = hashlib.sha512(password).hexdigest()
return "{SHA512-CRYPT}" + passhash return "{SHA512-CRYPT}" + passhash