Skip to content

Commit

Permalink
created API "create_password".
Browse files Browse the repository at this point in the history
  • Loading branch information
yjlc-pc committed Jun 7, 2024
1 parent 7fd5720 commit f48a68e
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/random-password.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion README.md
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.
23 changes: 23 additions & 0 deletions password.py
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))

0 comments on commit f48a68e

Please sign in to comment.