-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
# random-password | ||
# random-password | ||
This program is not very good.\ | ||
It save use base64.\ | ||
It can only create 2\ 4\ 6\ 8\ 16 byte's password. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import random | ||
import base64 | ||
LETTERS = ["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"] # password's all letter | ||
NUMBERS = [1,2,3,4,5,6,7,8,9] # password's all number | ||
OTHERS = ["`","-","=","[","]",'\\',";","'",".",",","/","~","!","@","#","$","%","^","&","*","(",")","_","+","{","}","|",":","\"","<",">","?"] # password's all fuhao | ||
|
||
def create_password(byte: int): | ||
password = "" | ||
letter_byte = random.randrange(0,byte) | ||
number_byte = random.randrange(0,byte-letter_byte) | ||
other_byte = byte-letter_byte-number_byte | ||
print(letter_byte,number_byte,other_byte) | ||
for _ in range(letter_byte): | ||
password += random.choice(LETTERS) | ||
for _ in range(number_byte): | ||
password += str(random.choice(NUMBERS)) | ||
for _ in range(other_byte): | ||
password += random.choice(OTHERS) | ||
return password | ||
|
||
|
||
|
||
print(create_password(9)) |