整合 dsAiTeachingModel 接口
This commit is contained in:
17
dsLightRag/Util/CommonUtil.py
Normal file
17
dsLightRag/Util/CommonUtil.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import hashlib
|
||||
import logging
|
||||
|
||||
# 配置日志
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def md5_encrypt(text):
|
||||
# 创建一个md5哈希对象
|
||||
md5_hash = hashlib.md5()
|
||||
# 更新哈希对象的数据,注意这里需要将字符串转换为字节类型
|
||||
md5_hash.update(text.encode('utf-8'))
|
||||
# 获取十六进制表示的哈希值
|
||||
encrypted_text = md5_hash.hexdigest()
|
||||
|
||||
return encrypted_text
|
Reference in New Issue
Block a user