diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1983bd7 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..646ab18 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/random-password.iml b/.idea/random-password.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/random-password.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 189092e..a4a5d38 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ -# random-password \ No newline at end of file +# random-password +This program is not very good.\ +It save use base64.\ +It can only create 2\ 4\ 6\ 8\ 16 byte's password. \ No newline at end of file diff --git a/password.py b/password.py new file mode 100644 index 0000000..75c2a33 --- /dev/null +++ b/password.py @@ -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))