# -*- coding: utf-8 -*-
import hashlib
# md5加密
str1 = 'Hello,World!'
h1 = hashlib.md5(str1.encode('utf-8'))
md5 = h1.hexdigest()
print(md5)
print(md5.upper()) # 转换大写
# sha256加密,其它方法类似
h2 = hashlib.sha256(str1.encode('utf-8'))
sha256 = h2.hexdigest()
print(sha256)
print(sha256.upper()) # 转换大写