hashlib module subprocess module

'' ' 
By an algorithm, derived string encoding
the same contents of the same hash computation result, the contents of the hash value change slightly changed
irreversibly push
the same algorithm, no matter how long the data verification, a hash value of a fixed length to give
'' '
# Import hashlib
# hashlib.md5 m = ()
# m.update (' hello'.encode ( 'UTF-. 8'))
# m.update ( 'world'.encode (' UTF-. 8 '))
Print # (m.hexdigest ()) # fc5e038d38a57032085441e7fe7010b0
# Import hashlib
# M1 = hashlib.md5 ()
# m1.update ( 'helloworl'.encode (' UTF-. 8 '))
# m1.update (' d'.encode ( 'UTF-. 8'))
# Print (m1.hexdigest ()) # fc5e038d38a57032085441e7fe7010b0
# Import hashlib
# name = INPUT ( '>>: name')
# pwd = INPUT ( '>>: pwd')
# m = hashlib .md5 ()
# m.update (pwd.encode('utf-8'))
# pwd=m.hexdigest()
# Print (name, PWD) # Egon 202cb962ac59075b964b07152d234b70
# import hashlib
# cryt_pwd = '202cb962ac59075b964b07152d234b70'
# pwds = [
# '123456',
# '12345',
# '123'
#]
# def make_dic (pwds):
# ticks = { }
# for PWD in pwds:
# m = hashlib.md5 (pwd.encode ( 'utf-8'))
# ticks [PWD] = m.hexdigest ()
# return ticks
# print (make_dic (pwds))
'' '
{ '123456': 'e10adc3949ba59abbe56e057f20f883e', '12345': '827ccb0eea8a706c4c34a16891f84e7b', '123': '202cb962ac59075b964b07152d234b70'}
'' '
# import hashlib
# cryt_pwd ='202cb962ac59075b964b07152d234b70'
# pwds=[
# '123456',
# '12345',
# '123'
# ]
# def make_dic(pwds):
# dic={}
# for pwd in pwds:
# m=hashlib.md5(pwd.encode('utf-8'))
# dic[pwd]=m.hexdigest()
# return dic
# dic=make_dic(pwds)
# for pwd in dic:
# if dic[pwd] == cryt_pwd:
# print(pwd)
'''
123
'''
# import hashlib
# m=hashlib.md5()
# m.update('123'.encode('utf-8'))
# print(m.hexdigest())
'''
202cb962ac59075b964b07152d234b70
'''
# import hashlib
# m=hashlib.sha512()
# m.update('123'.encode('utf-8'))
# print(m.hexdigest())
'''
3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7ab1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856bca5c44c2
'' '
# Import hashlib
# m = hashlib.md5 ('春宵一刻值千金'.encode (' UTF-. 8 '))
# m.update (' 123'.encode ( 'UTF-. 8'))
# m .update ( 'a female flower fragrance months' .encode (' UTF-. 8 '))
# Print (m.hexdigest ())
' ''
f4e3c0b586c48c46ea50ea3467323c77
'' '
# Import HMAC
# m = hmac.new (' salt '.encode (' UTF-. 8 '))
# m.update (' 123'.encode ( 'UTF-. 8'))
# Print (m.hexdigest ())
'' '
72e6bfeeacfc4b546338c9453205d1db
' ''
# The subprocess module
# import subprocess,time
# subprocess.Popen('tasklist',shell=True)
# print('>>:主')
# time.sleep(1)

# import subprocess,time
# subprocess.Popen('tasklist',shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE)
# print('>>:主')
# time.sleep(1)

# import subprocess,time
# obj=subprocess.Popen('tasklist',shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE)
# print(obj) # <subprocess.Popen object at 0x0000015B62E23F08>
# print(obj.stdout) # <_io.BufferedReader name=3>
# print(obj.stdout.read()) # 读值
# print('>>:主')

# import subprocess,time
# obj=subprocess.Popen('tasklist',shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE)
# print('第一次',obj.stdout.read())
# print('第二次',obj.stdout.read())
# print('>>:主')

# import subprocess,time
# obj=subprocess.Popen('tasklist',shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE)
# # print(obj.stdout.read()) # b'\r\n\xd3\xb3\xcf\xf1\xc3\xfb\xb3\xc6...
# print(obj.stdout.read().decode('gbk'))

# import subprocess,time
# obj=subprocess.Popen('tasklovelist',shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE)
# print(obj.stdout.read()) # b''
# print(obj.stderr.read().decode('gbk'))
'''
'tasklovelist' is not an internal or external command, operable program
or batch file.
'' '
# Import subprocess
# obj = subprocess.Popen (' tasklist | findstr Python ', shell = True,
# stdout = subprocess.PIPE,
# stderr = subprocess.PIPE)
# Print (obj.stdout.read ())
# Print (obj.stderr.read (). decode ( 'GBK'))
#
# Import The subprocess
#
# = subprocess.Popen OBJ1 ( 'tasklist', the shell = True,
# = stdout subprocess.PIPE,
# stderr = subprocess.PIPE )
#
# = obj2 subprocess.Popen ( 'the findstr Python', the shell = True,
# = stdin obj1.stdout,
# = stdout subprocess.PIPE,
# stderr=subprocess.PIPE)
#
# print(obj2.stdout.read())
# print(obj2.stderr.read().decode('gbk'))
'''
b'python.exe 15244 Console 1 10,652 K\r\n'

b'python.exe 15244 Console 1 10,704 K\r\n'
'''

Guess you like

Origin www.cnblogs.com/0B0S/p/12061383.html