day6-加密md5
Posted wxy90
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了day6-加密md5相关的知识,希望对你有一定的参考价值。
#md5,解密不了
import hashlib
s="wendy"
print(s.encode())#bytes,把字符串变成字节类型
m=hashlib.md5(s.encode())
result=m.hexdigest()
print(result)
#加盐
salt=\'234SSSS_@###\'
after=salt+s
m1=hashlib.md5(after.encode())
result1=m.hexdigest()
print(result1)
def test_md5(s,salt=\'\'):
s=str(s)
new_s="%s%s"%(s,salt)
m=hashlib.md5(new_s.encode())
return m.hexdigest()
with open("xpinyin-0.7.6-py3-none-sny.whl","rb") as f:
m=hashlib.md5(f.read())
print(m.hexdigest())
-----------------------------------------------------------------
def add(a,b):
return a+b
d={"a":1,"b":1}
print(add(**d))#2个*传入的是个字典
l=[1,2]
print(add(*l))#一个*传入的是个列表
---------------------------------------------------------------------
l=[[1,"wendy","女","北京"],
[2,"candy","女","上海"],
[3,"GG","男","南昌"]
]
# for i in l:
# print("i",i)
# for j in i:
# print(j)
k=[3,"GG","男","南昌"]
for index, i in enumerate(k):#enumerate(k,10)指定index从10开始
print(index,i)
import xlwt
book=xlwt.Workbook()
sheet=book.add_sheet("学生信息表1")
title=["id","name","性别","地址"]
for col,value in enumerate(title):
sheet.write(0,col,value)
for row, student in enumerate(l,1):
for col,value in enumerate(student):
sheet.write(row,col,value)
book.save("student1.xls")
以上是关于day6-加密md5的主要内容,如果未能解决你的问题,请参考以下文章