Python中进行Base64编码和解码要用base64模块,代码示例:

#-*- coding: utf-8 -*-
import base64

str = 'cnblogs'
str64 = base64.b64encode(str)
print str64                     #Y25ibG9ncw==
print base64.b64decode(str64)   #cnblogs

二、MD5

#Python 2.x
import hashlib
print hashlib.md5("whatever your string is").hexdigest()


#Python 3.x
import hashlib
print(hashlib.md5("whatever your string is".encode('utf-8')).hexdigest())

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-10-28
  • 2022-01-08
  • 2021-04-27
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2021-06-18
  • 2021-09-07
  • 2022-12-23
  • 2022-01-27
相关资源
相似解决方案