使用python3的base64编解码实现字符串的简易加密解密,python3base64,import base6
文章由Byrx.net分享于2019-03-23 10:03:53
使用python3的base64编解码实现字符串的简易加密解密,python3base64,import base6
import base64copyright = 'Copyright (c) 2012 Doucube Inc. All rights reserved.'def main(): #转成bytes string bytesString = copyright.encode(encoding="utf-8") print(bytesString) #base64 编码 encodestr = base64.b64encode(bytesString) print(encodestr) print(encodestr.decode()) #解码 decodestr = base64.b64decode(encodestr) print(decodestr.decode())if __name__ == '__main__': main()
输出结果
*** Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32. ***>>> *** Remote Interpreter Reinitialized ***>>> b'Copyright (c) 2012 Doucube Inc. All rights reserved.'b'Q29weXJpZ2h0IChjKSAyMDEyIERvdWN1YmUgSW5jLiBBbGwgcmlnaHRzIHJlc2VydmVkLg=='Q29weXJpZ2h0IChjKSAyMDEyIERvdWN1YmUgSW5jLiBBbGwgcmlnaHRzIHJlc2VydmVkLg==Copyright (c) 2012 Doucube Inc. All rights reserved.>>>
相关内容
- python中同时给多个变量赋值,python多个变量赋值,# Ass
- Find the coefficients of the polynomial that fits the specified data
- python中使用MD5加密字符串,pythonmd5,#--encoding=
- python中创建关联数组(字典),python数组,# Dictionary
- 睡眠排序法 - python版,排序python,import sys,
- django获得用户ip地址,django获得ip,def get_clie
- python计算方程式的根的代码,python计算方程式,''' root
- matplotlib中,如何在坐标系中画一个矩形,matplotlib坐标系
- python连接url的不同部分,python连接url不同,import urlpa
- python通过while循环计算1到n的和,pythonwhile,def sum(n):
评论关闭