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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值