import hashlib# 第一步是:召唤hash对象,hashlib.md5(salt.encode('utf-8'))里,一定要进行“加盐”# salt是随机乱输入的字符串,防止撞库撞出来hash_object = hashlib.md5("iajfsdunjaksdjfasdfasdf".encode('utf-8'))# 第二步是:update(text.encode('utf-8'))在这里,输入被加密的文本信息hash_object.update("武沛齐".encode('utf-8'))# 第三步是:hash_object.hexdigst()获得密文result = hash_object.hexdigest()print(result)
