File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ import random
2
+ lChars = 'abcdefghijklmnopqrstuvwxyz'
3
+ uChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4
+ digits = '1234567890'
5
+ specialChars = '!@#$%^&*-_+='
6
+
7
+ passLen = 10 #actual generated password length will be this length + 1
8
+ myPass = ''
9
+
10
+ for i in range (passLen ):
11
+ while (len (myPass )) <= 2 :
12
+ index = random .randrange (len (lChars ))
13
+ myPass = myPass + lChars [index ]
14
+ myPassLen = len (myPass )
15
+ while (len (myPass )) <= 5 :
16
+ index = random .randrange (len (digits ))
17
+ myPass = myPass + digits [index ]
18
+ myPassLen = len (myPass )
19
+ while (len (myPass )) <= 7 :
20
+ index = random .randrange (len (specialChars ))
21
+ myPass = myPass + specialChars [index ]
22
+ myPassLen = len (myPass )
23
+ while (len (myPass )) <= 10 :
24
+ index = random .randrange (len (uChars ))
25
+ myPass = myPass + uChars [index ]
26
+ myPassLen = len (myPass )
27
+
28
+ print (myPass )
29
+
You can’t perform that action at this time.
0 commit comments