Python 生成密码字典算法(初学Python笔记)
来源:互联网 发布:歌词匹配软件 编辑:程序博客网 时间:2024/06/05 18:01
#!/usr/bin/python
# -*- coding: UTF-8 -*-
fo = open("foo.txt", "r")
def createWords(currentWidth,wordslist,lastresultList,totalArray):
if 1==currentWidth:
lastresultList=[]
lastresultList.extend(wordslist)
totalArray.extend(wordslist);
return lastresultList;
else:
preWords= createWords( currentWidth-1, wordslist, lastresultList,totalPwd)
lastresultList=[]
for word in wordslist:
for lastWord in preWords:
newResult=word+lastWord
totalArray.append(newResult)
lastresultList.append(newResult)
return lastresultList
# =============================================================================
array = [];
totalPwd= [];
print "========按行读区文件中的数据,每行作为密码的组成单元=============="
for line in fo.xreadlines():
line = line.strip("\n")
array.append(line)
print "======================"
print '单元数据共:',len(array),"个"
print "=======以文件中的每一行作为单元来组合密码==============="
xwidth=2#生成密码的用的元数据个数,生成2个单元的密码,这里可以为大于1的任何整数,
resultWorlds=createWords(xwidth,array,array,totalPwd)
#
print "组成的",xwidth,"位密码共",len(resultWorlds)
print "所有密码共",len(totalPwd),"个(包含1-",xwidth,")位"
- Python 生成密码字典算法(初学Python笔记)
- python生成密码字典
- Python生成MD5密码字典库
- Python初学之字典
- 密码字典生成算法
- Python学习笔记(四)生成字典
- 【Python初学笔记】no.2字典和函数及练习
- python模拟mysql password密码生成算法
- python生成嵌套字典
- Python初学笔记~
- Python初学笔记(1)
- python初学笔记(2)
- Python初学笔记
- Python 初学笔记
- Python初学笔记
- python初学笔记
- python初学的笔记
- 初学python笔记。
- 【华为 OJ】输入一行字符,分别统计出包含英文字母、空格、数字和其它字符的个数。
- 一个人做事情觉得快乐,很多人觉得不务正业。 一个人做事痛苦,很多人觉得在做正经事
- phpcmsv9 如何实现用户登录
- assert
- ios逆向资料,盘古博客等学习资料
- Python 生成密码字典算法(初学Python笔记)
- 稀疏矩阵存储和查找
- (转)rawQuery()方法的使用例子
- 事件的产生和传递
- 网页左侧静态不动的图片广告代码
- 出栈序列判定 网上一些代码虽然能AC但是有bug
- Oracle EBS诊断方面几种情况的解决方法(诊断菜单隐藏、个性化功能报错、关于此页的显示)
- 手写数字图片库MNIST百度网盘下载链接~
- gai