Python的md5加密
阿新 • • 發佈:2019-01-02
Python md5加密
#!/usr/bin/python # -*- coding: UTF-8 -*- ''' zhouzhongqing 各種測試 ''' #md5 import hashlib if __name__ == '__main__': '''md5的測試 ''' m = hashlib.md5() m.update(b"123456") #引數必須是byte型別,否則報Unicode-objects must be encoded before hashing錯誤 md5value=m.hexdigest(); print(md5value); m = hashlib.md5(); m.update(md5value.encode()+b'c60b46');#md5value.encode()轉換為byte型別的 md5value = m.hexdigest(); print(md5value) #67fc8fd6614ffee2b4e12c2dd3d999b5