Python的md5加密
Python md5加密
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
zhouzhongqing
各种测试
'''
#md5
import hashlib
if __name__ == '__main__':
'''md5的测试 '''
m = hashlib.md5()
m.update(b"123456") #参数必须是byte类型,否则报Unicode-objects must be encoded before hashing错误
md5value=m.hexdigest();
print(md5value);
m = hashlib.md5();
m.update(md5value.encode()+b'c60b46');#md5value.encode()转换为byte类型的
md5value = m.hexdigest();
print(md5value) #67fc8fd6614ffee2b4e12c2dd3d999b5