Python中hashlib模块, 快捷加密数据
2014-01-10 15:04
666 查看
#!/usr/bin/python #coding:utf-8 import hashlib data = "test" # using md5 md5Object = hashlib.md5() md5Object.update(data) result = md5Object.hexdigest() print "MD5: ", result # using sha1 sha1Object = hashlib.sha1() sha1Object.update(data) result = sha1Object.hexdigest() print "SHA1: ", result # using sha224 sha224Object = hashlib.sha224() sha224Object.update(data) result = sha224Object.hexdigest() print "SHA224: ", result # using sha256 sha256Object = hashlib.sha256() sha256Object.update(data) result = sha256Object.hexdigest() print "SHA256: ", result # using sha384 print "SHA384: ", hashlib.sha384(data).hexdigest() # using sha512 print "SHA512: ", hashlib.sha512(data).hexdigest()
相关文章推荐
- Python3 加密(hashlib和hmac)模块的实现
- Python模块学习 ---- hashlib hash加密
- Python之数据加密与解密及相关操作(hashlib、hmac、random、base64、pycrypto)
- 【Python模块】os & linecache & hashlib & commands & sys & time & datetime
- Python hashlib模块
- Python hashlib模块 (主要记录md5加密)
- Python模块学习之hashlib-MD5在接口测试中的应用
- python 内置模块之hashlib、hmac、uuid
- python matplotlib模块——绘制三维图形、三维数据散点图
- Python3 加密(hashlib / hmac)
- Python学习笔记(三十六)— 内置模块(5)hashlib 摘要算法
- python模块:hashlib
- python之hashlib、configparser、logging模块
- Python模块学习之hashlib-MD5在接口测试中的应用
- Python hashlib模块
- Python3 加密(hashlib / hmac)
- Python hashlib模块 (主要记录md5加密)
- 利用Python中的matplotlib模块抓取yahoo finance里的历史数据并绘图
- pythopn hashlib 模块(加密)
- Python hashlib模块 (主要记录md5加密)