一、base64加密解密
加密:
- >>> import base64
- >>> encode = base64.b64encode(b'I love you')
- >>> encode
- b'SSBsb3ZlIHlvdQ=='
- >>> import base64
- >>> decode = base64.b64decode(b'SSBsb3ZlIHlvdQ==')
- >>> decode
- b'I love you'
跟base64相似就是将base64.b64encode变成base64.b32encode
加密:
- >>> import base64
- >>> encode = base64.b32encode(b'I love you')
- >>> encode
- b'JEQGY33WMUQHS33V'
- >>> import base64
- >>> decode = base64.b32decode(b'JEQGY33WMUQHS33V')
- >>> decode
- b'I love you'
类似的将base64.b32encode变成base64.b16encode
加密解密过程与base64、base32一样,这里就不在赘述
如有错误,欢迎指出!