码迷,mamicode.com
首页 > 其他好文 > 详细

hashlib 加密

时间:2018-11-10 23:52:33      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:常用   pass   加密   password   nbsp   new   hex   lib   字符串   

1.  imort hashlib

   password = "11234"

2.  salt2 = "aada".encode()  #加盐编码字符串

3.  result = hashlib.md5(password + salt2)  #用md5加密

    ( result = hashlib.new("md5",password)  另一种new,不常用  )

4.  print( result.hexdigest() )  打印数据

   print( result.digest() )    打印二进制数据

5.  result = hashlib.pdkdf2_hmac("md5",password,salt2,1000)  #加密密码常用 1000为加密次数

     技术分享图片

 

hashlib 加密

标签:常用   pass   加密   password   nbsp   new   hex   lib   字符串   

原文地址:https://www.cnblogs.com/cxhzy/p/9940959.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!