pip install passlib from passlib.hash import des_crypt # 使用方式类似 hash_result des_crypt.hash(egg, saltHX) print(hash_result) # 输出类似HX9LLTdc/jiDE # 验证 print(des_crypt.verify(egg, HX9LLTdc/jiDE)) # True