python 数据加密测试 -base64

学Python,用RPA

艺赛旗RPA2020.1版本 正在免费下载使用中,欢迎下载使用

www.i-search.com.cn/index.html?from=line1

#!/usr/bin/env Python3

-- coding: utf-8 --

@Software: PyCharm

@virtualenv:workon

@contact: 1040691703@qq.com

@Desc:Code descripton

author = ‘未昔/AngelFate’
date = ‘2020/4/28 12:58’

import base64

test = ‘hello, world’

加密

bs = base64.b64encode(test.encode(“utf8”))
print(bs)

解密

decode = base64.b64decode(bs)
print(decode)
print(decode.decode(“utf8”))

“”"
python3 输入的都是 二进制 byte类型
注意:用于base64编码的,要么是ASCII包含的字符,要么是二进制数据
base64 是对称加密
“”"
b’aGVsbG8sIHdvcmxk’
b’hello, world’
hello, world

Process finished with exit code 0
#!/usr/bin/env Python3

-- coding: utf-8 --

@Software: PyCharm

@virtualenv:workon

@contact: 1040691703@qq.com

@Desc:Code descripton

author = ‘未昔/AngelFate’
date = ‘2020/4/28 12:58’

import base64

test = ‘hello, world’

加密

bs = base64.b64encode(test.encode(“utf8”))
print(bs)

解密

decode = base64.b64decode(bs)
print(decode)
print(decode.decode(“utf8”))

“”"
python3 输入的都是 二进制 byte类型
注意:用于base64编码的,要么是ASCII包含的字符,要么是二进制数据
base64 是对称加密
“”"

b’aGVsbG8sIHdvcmxk’
b’hello, world’
hello, world

Process finished with exit code 0
b’aGVsbG8sIHdvcmxk’
b’hello, world’
hello, world

Process finished with exit code 0


版权声明:本文为weixin_44447687原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。