-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee0f31b
commit b3c70f4
Showing
10 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import random | ||
import string | ||
|
||
def generate_password(length): | ||
if length < 4: | ||
print("Password length should be at least 4 characters.") | ||
return | ||
|
||
# Define character sets for each category | ||
uppercase_letters = string.ascii_uppercase | ||
lowercase_letters = string.ascii_lowercase | ||
digits = string.digits | ||
special_characters = string.punctuation | ||
|
||
# Make sure we have at least one character from each category | ||
password = ( | ||
random.choice(uppercase_letters) + | ||
random.choice(lowercase_letters) + | ||
random.choice(digits) + | ||
random.choice(special_characters) | ||
) | ||
|
||
# Fill the remaining password length with random characters | ||
remaining_length = length - 4 | ||
all_characters = uppercase_letters + lowercase_letters + digits + special_characters | ||
password += ''.join(random.choice(all_characters) for _ in range(remaining_length)) | ||
|
||
# Shuffle the password to make it more random | ||
password_list = list(password) | ||
random.shuffle(password_list) | ||
return ''.join(password_list) | ||
|
||
# Get user input for password length | ||
password_length = int(input("Enter the length of the password: ")) | ||
strong_password = generate_password(password_length) | ||
print("Generated strong password:", strong_password) |
Binary file added
BIN
+25.6 KB
node_modules/.cache/babel-loader/19cf6c6b0f5b1e283c28ab2d2b444b26.json.gz
Binary file not shown.
Binary file added
BIN
+6.96 KB
node_modules/.cache/babel-loader/363cadcc0d9c143f59e7a5fa576a4e1e.json.gz
Binary file not shown.
Binary file added
BIN
+8.65 KB
node_modules/.cache/babel-loader/72ac7183b204d97d288b15d408326e90.json.gz
Binary file not shown.
Binary file added
BIN
+7.43 KB
node_modules/.cache/babel-loader/77ebe0341b35b12c8fa29c0657e5117e.json.gz
Binary file not shown.
Binary file added
BIN
+2.87 KB
node_modules/.cache/babel-loader/90be17924a9d192cf4acfc9138726f4f.json.gz
Binary file not shown.
Binary file added
BIN
+2.18 KB
node_modules/.cache/babel-loader/a3cefdb39e7d47b790dedb63ddfc58ef.json.gz
Binary file not shown.
Binary file added
BIN
+9.13 KB
node_modules/.cache/babel-loader/be4c44bd320e8a81f1743ac7b087d9c3.json.gz
Binary file not shown.
Binary file added
BIN
+6.87 KB
node_modules/.cache/babel-loader/f68f602cb8c3d9420b67b5a5820d0fa5.json.gz
Binary file not shown.