base64简单使用

加密:

import base64
import random
str ="aqwertyuiopasdfghjklzxcvbnm963.0852741,.;'"
a = '人生苦短,我用Python'
b = base64.b64encode((a+str).encode('utf-8'))
print(b)

结果:
b'5Lq655Sf6Ium55+tLOaIkeeUqFB5dGhvbmFxd2VydHl1aW9wYXNkZmdoamtsenhjdmJubTk2My4wODUyNzQxLC47Jw=='

解密:

c = base64.b64decode(b).decode("utf-8")
print(c)

结果:
人生苦短,我用Pythonaqwertyuiopasdfghjklzxcvbnm963.0852741,.;'

 

posted @ 2019-03-12 08:25  Xcsg  Views(1088)  Comments(0Edit  收藏  举报