天使漫步IT工作室天使漫步IT工作室

【代码片段】 Python MD5加密


Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 110

Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 116

python md5加密或者生成串操作。

方法一:

import hashlib
class md():
    def md5(self,t,a):
        da=t+a      
        print(da)
        md5=hashlib.md5()
        sign_bytes_utf8=da.encode()
        md5.update(sign_bytes_utf8)
        sign_md5=md5.hexdigest()
        print(sign_md5)
        return  sign_md5
    def md5(self,t):
        return self.md5(t,'')

方法二:

import md5

src = 'this is a md5 test.'   
m1 = md5.new()   
m1.update(src)   
print m1.hexdigest()   

本站原创,欢迎转载,转载敬请标明出处:天使漫步IT工作室 » 【代码片段】 Python MD5加密
添加新评论


Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /www/wwwroot/u11u.com/usr/themes/wq/comments.php on line 38