首页 > 其他分享 >md5加密

md5加密

时间:2022-12-23 09:12:11浏览次数:35  
标签:files 加密 sign str md5 mypass

import requests

import hashlib


#测试文件上传

files = {'file':('touxiang.png',open('c:/touxiang.png','rb'))}

res = requests.post('http://localhost:8000/upload/',files=files)


print(res.text)


#md5加密
def make_password(mypass):

	#生成对象
	md5 = hashlib.md5()
	#定义加密对象
	sign_str = mypass
	#转码
	sign_utf8 = str(sign_str).encode(encoding="utf-8")
	#加密
	md5.update(sign_utf8)
	#生成密文
	md5_server = md5.hexdigest()

	return md5_server

标签:files,加密,sign,str,md5,mypass
From: https://www.cnblogs.com/djl-0628/p/16999976.html

相关文章