标签:color ssh attr sha .sh 展示 sub repr bsp
import hashlib password =‘12f3456‘ m = hashlib.md5(password.encode()) # m1=hashlib.sha1(password.encode()) #sha1加密方法 # m2=hashlib.sha224(password.encode()) print(password.encode()) #字符串encode变成二进制 b‘123456‘,字符串只能转换成二进制的才能进行加密 print(dir(m)) #将m能用的方法全部展示.如果忘记了某个元素有什么方法,可以用dir()展示出来 ‘‘‘‘ [‘__class__‘, ‘__delattr__‘, ‘__dir__‘, ‘__doc__‘, ‘__eq__‘, ‘__format__‘, ‘__ge__‘, ‘__getattribute__‘, ‘__gt__‘, ‘__hash__‘, ‘__init__‘, ‘__init_subclass__‘, ‘__le__‘, ‘__lt__‘, ‘__ne__‘, ‘__new__‘, ‘__reduce__‘, ‘__reduce_ex__‘, ‘__repr__‘, ‘__setattr__‘, ‘__sizeof__‘, ‘__str__‘, ‘__subclasshook__‘, ‘block_size‘, ‘copy‘, ‘digest‘, ‘digest_size‘, ‘hexdigest‘, ‘name‘, ‘update‘] ‘‘‘ print(m.hexdigest()) #将m进行加密 print(len(m.hexdigest())) #不管密码多长,只能返回一个32的MD5加密的字符串。且MD5不可逆
标签:color ssh attr sha .sh 展示 sub repr bsp
原文地址:https://www.cnblogs.com/miyatest/p/10124172.html