'''
通过一种算法,将字符串得出一种编码
内容相同则hash运算结果相同,内容稍微改变则hash值改变
不可逆推
相同算法,无论校验多长的数据,得到的hash值长度固定
'''
# import hashlib
# m=hashlib.md5()
# 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):
# dic={}
# for pwd in pwds:
# m=hashlib.md5(pwd.encode('utf-8'))
# dic[pwd]=m.hexdigest()
# return dic
# 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('花有清香月有阴'.encode('utf-8'))
# print(m.hexdigest())
'''
f4e3c0b586c48c46ea50ea3467323c77
'''
# import hmac
# m=hmac.new('加盐'.encode('utf-8'))
# m.update('123'.encode('utf-8'))
# print(m.hexdigest())
'''
72e6bfeeacfc4b546338c9453205d1db
'''
# subprocess模块
# 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' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'''
# 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 subprocess
#
# obj1=subprocess.Popen('tasklist',shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.PIPE)
#
# obj2=subprocess.Popen('findstr python',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'
'''

hashlib模块subprocess模块的更多相关文章

  1. s14 第5天 时间模块 随机模块 String模块 shutil模块(文件操作) 文件压缩(zipfile和tarfile)shelve模块 XML模块 ConfigParser配置文件操作模块 hashlib散列模块 Subprocess模块(调用shell) logging模块 正则表达式模块 r字符串和转译

    时间模块 time datatime time.clock(2.7) time.process_time(3.3) 测量处理器运算时间,不包括sleep时间 time.altzone 返回与UTC时间 ...

  2. python hashlib模块 logging模块 subprocess模块

    一 hashlib模块 import hashlib md5=hashlib.md5() #可以传参,加盐处理 print(md5) md5.update(b'alex') #update参数必须是b ...

  3. Python基础之模块:6、hashlib模块 subprocess模块 logging模块

    目录 一.hashlib模块 1.简介 2.基本操作与用法 二.subprocess模块 1.简介 2.基本操作与用法 三.logging模块 1.简介 2.基本操作与用法 一.hashlib模块 1 ...

  4. Python全栈之路----常用模块----subprocess模块

    我们经常需要通过Python去执行一条系统命令或脚本,系统的shell命令是独立于你的python进程之外的,每执行一条命令,就是发起一个新进程,通过python调用系统命令或脚本的模块在python ...

  5. os模块,os.path模块,subprocess模块,configparser模块,shutil模块

    1.os模块 os表示操作系统该模块主要用来处理与操作系统相关的操作最常用的文件操作打开 读入 写入 删除 复制 重命名 os.getcwd() 获取当前执行文件所在的文件夹路径os.chdir(&q ...

  6. os模块-subprocess 模块- configpaser 模块

    一. os 模块 主要用于处理与操作系统相关操作,最常用文件操作 使用场景:当需要操作文件及文件夹(增,删,查,改) os.getcwd()  获取当前工作目录 os.chdir('dirname') ...

  7. re模块,subprocess模块

    """ RE是什么 正则 表达 式子 就是一些带有特殊含义的符号或者符号的组合 它的作用是对字符串进行过滤 在一堆字符串中找到你所关心的内容 你就需要告诉计算机你的过滤规 ...

  8. Python re模块 subprocess模块

    re模块 内部实现不是Python 而是调用了c的库 re是什么 正则 表达 式子 就是一些带有特殊含义的符号或者符号的组合作用: 对字符串进行过滤 在一对字符串中找到所关心的内容 你就需要告诉计算机 ...

  9. python实现系统调用cmd命令的模块---subprocess模块

    如果要python实现系统命令或者调用脚本,python中可以利用os或者subprocess模块实现: 一.os模块: # coding:utf-8 command = os.system('net ...

随机推荐

  1. HashSet 源码分析

    HashSet 1)HashSet 是基于 HashMap 的 Set 接口实现,元素的迭代是无序的,可以使用 null 元素. 创建实例 /** * HashSet基于HashMap实现 */ pr ...

  2. hive三种方式区别和搭建

    Hive 中 metastore(元数据存储)的三种方式:         a)内嵌 Derby 方式         b)Local 方式          c)Remote 方式    第一种方式 ...

  3. python 卡方检验例子

    python 求拒绝域和卡方值 import scipy.stats as ss obs=[107,198,192,125,132,248] exp=[167]*6 #拒绝域 1%的显著水平,自由度5 ...

  4. (转)Intellij IDEA 自动生成 serialVersionUID

    转自 : https://blog.csdn.net/tiantiandjava/article/details/8781776 Setting->Inspections->Seriali ...

  5. LeetCode——160 Intersection of Two Linked Lists

    题目 Input: intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3 Output: ...

  6. 执行 bower -v 时出现内部错误

    安装nodejs ,我的位置是D:\node.js_install.全局模块安装默认放在C:\Users\Administrator\AppData\Roaming\npm\node_modules里 ...

  7. 007/Docker(一)

    Docker 属于 Linux 容器的一种封装,提供简单易用的容器使用接口. Docker 将应用程序与该程序的依赖,打包在一个文件里面.运行这个文件,就会生成一个虚拟容器.程序在这个虚拟容器里运行, ...

  8. 链表两数相加(add two numbers)

    问题 给出两个 非空 的链表用来表示两个非负的整数.其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字. 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它 ...

  9. 分布式 vs 集群 主从 vs 集群

      理解 分布式 一个业务拆分成多个子业务,部署在不同的服务器上 集群 同一个业务部署在多个服务器上   更新 主从 服务器之间更新是异步的,从服务器可能和主服务器不一致 集群 更新是同步的,数据节点 ...

  10. 前端 CSS的选择器 属性选择器

    属性选择器,字面意思就是根据标签中的属性,选中当前的标签. 属性选择器 通常在表单控件中 使用比较多 根据属性查找 /*用于选取带有指定属性的元素.*/ <!DOCTYPE html> & ...