Hashing a file in Python

前端 未结 6 1143
误落风尘
误落风尘 2020-11-27 10:55

I want python to read to the EOF so I can get an appropriate hash, whether it is sha1 or md5. Please help. Here is what I have so far:

import hashlib

inputF         


        
6条回答
  •  春和景丽
    2020-11-27 11:31

    import hashlib
    user = input("Enter ")
    h = hashlib.md5(user.encode())
    h2 = h.hexdigest()
    with open("encrypted.txt","w") as e:
        print(h2,file=e)
    
    
    with open("encrypted.txt","r") as e:
        p = e.readline().strip()
        print(p)
    

提交回复
热议问题