dms-client/util/md5_util.py

17 lines
397 B
Python
Raw Normal View History

import hashlib
class Md5Util(object):
def __init__(self, *, salt: str, password: str):
self.salt = salt
self.password = password
def md5(self):
# 实例化对象, 加盐
obj = hashlib.md5(self.salt.encode('utf-8'))
# 加密密码
obj.update(self.password.encode('utf-8'))
# 提取密码,返回
return obj.hexdigest()