因为之前想写传参来校验加密密码是否一直,但有不想用update方法;

 1 import hashlib
 2 passwd = hashlib.md5(b"mologa").hexdigest()
 3 print(passwd)
 4 
 5 a="mologa"
 6 passwd = hashlib.md5(a.encode()).hexdigest()
 7 print(passwd)
 8 
 9 ----结果-----
10 9bac98b116e76bd031e9d9a7c84daea3
11 9bac98b116e76bd031e9d9a7c84daea3
12 
13 Process finished with exit code 0

 

#密码加密
def getpasswd(args):
    import hashlib
    passwd = hashlib.md5(args.encode()).hexdigest()
    return passwd

mologa = input("enter you passwd:")
print(getpasswd(mologa))


------结果------
enter you passwd:mologa
9bac98b116e76bd031e9d9a7c84daea3

  

posted on 2017-07-06 13:53  缪阿布  阅读(329)  评论(0编辑  收藏  举报