0%

Python MD5

Python MD5

MD5.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import hashlib
class MD5:
def str():
str=input()
m = hashlib.md5()
m.update(str.encode('utf-8'))
print (m.hexdigest())

def filebin():
src=input()
f = open(src, 'rb')
f_md5 = hashlib.md5()
f_md5.update(f.read())
print (f_md5.hexdigest())

def file():
src=input()
f = open(src, 'r')
f_md5 = hashlib.md5()
f_md5.update(f.read().encode('utf-8'))
print (f_md5.hexdigest())

if __name__=='__main__':
try:
while True:
MD5.filebin()
except EOFError:
exit()
写文不易,感谢支持!
Writing is not easy. Thank you for your support.