-
Notifications
You must be signed in to change notification settings - Fork 85
Password Generator #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ShivamPande18
wants to merge
1
commit into
bislara:master
Choose a base branch
from
ShivamPande18:password-generator
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Password Generator #349
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,40 @@ | ||
| import string | ||
| import random | ||
|
|
||
| length = int(input("Enter length of your password:\n")) | ||
|
|
||
| DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] | ||
| UPPER_CASE = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','I', | ||
| 'J', 'K', 'M', 'N', 'O', 'P', 'Q','R', 'S', | ||
| 'T', 'U', 'V', 'W', 'X', 'Y','Z'] | ||
| LOWER_CASE = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', | ||
| 'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', | ||
| 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', | ||
| 'z'] | ||
| SYMBOLS = ['@', '#', '$', '%', '=', ':', '?', '.', '/', | ||
| '|', '~', '>', '*', '(', ')', '<'] | ||
|
|
||
| #ALl the valid characters that can be used in a password | ||
| VALID_CHARS = DIGITS+UPPER_CASE+LOWER_CASE+SYMBOLS | ||
|
|
||
| #Adding atleast 1 character of all types of valid characters | ||
| password_temp = random.choice(DIGITS)+ random.choice(UPPER_CASE)+ random.choice(LOWER_CASE)+ random.choice(SYMBOLS) | ||
|
|
||
| if(length<8): | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you have added only 4 chars in the top, the if condition will always be false right? |
||
| print("Password must be atleast 8 character long") | ||
| else: | ||
| for i in range(length-4): | ||
|
|
||
| #get the rest of the valid characters randomly | ||
| password_temp += random.choice(VALID_CHARS) | ||
|
|
||
| #Convert password_temp into a list and shuffle it | ||
| password_list = list(password_temp) | ||
| random.shuffle(password_list) | ||
|
|
||
| #Convert yhe shuffled password_list back to password string | ||
| password = "" | ||
| for x in password_list: | ||
| password+=x | ||
|
|
||
| print(password) | ||
This file contains hidden or 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,7 @@ | ||
| ##Description | ||
|
|
||
| A simple CLI password generator in which you enter the length of the password you'd like to generate (Minimum 6) and it creates a strong random password containing symbols, capital letters, regular letters and numbers. (Hacktoberfest Project). | ||
|
|
||
| ##Technologies and Languages | ||
|
|
||
| - Python |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So everytime the pwd will have digit, upper_case,lower_case_symbols in the beginning in the same order. Can you modify this to have it in random sequence.