python3 md5加密实现
方法1 通过argv实现 1 import hashlib 2 import sys 3 from sys import argv 4 input_name = hashlib.md5() #要加密的字符串 5 argv1 = sys.argv[1] #获取要加密的字符串 6 input_name.update(argv1.encode("utf-8")) 7 print(input_name.hexdigest()) 方法2 def 函数方法实现 import hashlib def md5vale(key): input_name = hashlib.md5() input_name.update(key.encode("utf-8")) print(key," ----> ",input_name.hexdigest()) md5vale("大傻瓜") 方法3 持续输入要加密的字符串 1 import hashlib 2 count = 0 3 loop = 0 4 while count == 0 : 5 6 print("请输入 要加密的md5") 7 8 key = input() 9 input_name = hashlib.md5() 10 input_name.update(key.encode("utf-8")) 11 # count +=1 12 loop +