Originally wanted to be poor to lift all passwords, the algorithm is either nested too deep, or special consumption of memory (will overflow). Later, a simple algorithm with very low repetition probability was chosen. The code is as follows:
Copy the Code code as follows:
#-*-Coding:utf-8-*-
'''
@ function: Generate a random password dictionary
'''
Import Random
Class Dictor ():
Cset= ' abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&* () _-+=/*<>:;\ ' "[]{}| '
def __init__ (Self,minlen,maxlen):
If Maxlen>minlen:
Self.__minlen=minlen
Self.__maxlen=maxlen
Else
Self.__minlen=maxlen
Self.__maxlen=minlen
def __iter__ (self):
return self
def __next__ (self):
Ret= "
For I in range (0,random.randrange (self.__minlen,self.__maxlen+1)):
Ret+=random.choice (Dictor.cset)
return ret
If __name__== ' __main__ ':
For STR in Dictor (6,16):
Print (str)