2013年2月20日
摘要: md5(Message-Digest Algorithm 5) 模块用于计算信息密文(信息摘要),得出一个128位的密文。sha模块跟md5相似,但生成的是160位的签名。使用方法是相同的。如下实例是使用md5的:# /usr/bin/python# -*- coding:utf-8 -*-import base64try: import hashlib hash = hashlib.md5()except ImportError: # for Python << 2.5 import md5 hash = md5.new()hash.update('spam,s... 阅读全文
posted @ 2013-02-20 19:41 mingaixin 阅读(19926) 评论(0) 推荐(1) 编辑
摘要: 今天在学习python的md5模块的时候,做练习,遇到DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5的警告;# /usr/bin/python# -*- coding:utf-8 -*-import md5hash = md5.new()hash.update('spam,spam,and egges')print repr(hash.digest())执行结果为:解决办法:# /usr/bin/python# -*- coding:utf-8 -*-try: im 阅读全文
posted @ 2013-02-20 16:09 mingaixin 阅读(5145) 评论(0) 推荐(0) 编辑