标签:
一. 使用md5包
import md5
src = ‘this is a md5 test.‘
m1 = md5.new()
m1.update(src)
print m1.hexdigest()
二. 使用hashlib
import hashlib
m2 = hashlib.md5()
m2.update(src)
print m2.hexdigest()
推荐使用第二种方法。
标签:
原文地址:http://www.cnblogs.com/turingbrain/p/5430611.html