python-加密(base64)
import base64 #base64也是用来加密的,但是这个是可以解密的 s = "username" byte类型print(base64.b64encode(s.encode()) ) #加密 new_s = base64.b64encode(s.encode()) old_s = base64.b64decode(new_s).decode()) def bs64_data_encode(st): salt='jmy12345' new_str = str(st)+salt encode_str = base64.b64encode(new_str.encode()).decode() return encode_str print(bs64_data_encode('老宋')) def bs64_data_decode(st): salt='jmy12345' res = base64.b64decode(st).decode() res = res.replace(salt,'') return res print(bs64_data_decode('6ICB5a6Lam15MTIzNDU='))
不深思则不能造于道。不深思而得者,其得易失。