加密在项目中 必不可少 那么在python中的加密又有哪些方式呢
# 加密模块
import hashlib
a = '123456'
m = hashlib.md5()
print(m)
md5 = hashlib.md5()
md5.update(a.encode('utf-8'))
print(md5.hexdigest()) # e10adc3949ba59abbe56e057f20f883e
md5.update('789'.encode('utf8'))
print(md5.hexdigest()) # 25f9e794323b453885f5181f1b624d0b
md52 = hashlib.md5()
md52.update('123456789'.encode('utf-8'))
print(md52.hexdigest()) # 25f9e794323b453885f5181f1b624d0b
# 另外一种加密
ha = hashlib.sha256()
ha.update('123456789'.encode('utf8'))
print(ha.hexdigest()) # 15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225
加密不可逆,但是却有唯一性