Skip to content

Commit

Permalink
Merge pull request #62 from UBC-MDS/example_file
Browse files Browse the repository at this point in the history
add documentation for generate_password & update function
  • Loading branch information
zywkloo authored Jan 26, 2024
2 parents 8ac65ad + 89a43b6 commit 1ff7aaa
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 5 deletions.
116 changes: 112 additions & 4 deletions docs/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@
"For the past 10 years, Bob has been using the password 'baseball' for all his online accounts. While this made them easy to remember, it also made them easy to hack. Unfortunately for Bob, some not-so-flattering photos of his trip to Cancun were sent to **all** of his Facebook friends (think sunglasses burn). Due to this incident, Bob has decided to up his password security and begins by testing the strength of his previously used password. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Password Strength"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -96,12 +103,113 @@
"Finally! Something Bob can work with, he's found a password he likes that is also strong. But then Bob reads about our password generator and decides to give that a try instead."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Generate Password\n",
"\n",
"The `generate_password` function allows users to create a secure, customized password.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### First try: default settings\n",
"\n",
"Bob creates a password with the default settings. This returns a password of length 12, with at least one uppercase letter, number and symbol. "
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'`iw:XP-t<32J'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from passwordler.generate_password import generate_password\n",
"\n",
"generate_password()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Going for Length"
]
},
{
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": []
"source": [
"Intrigued, Bob decides to generate a much longer password, setting the `length` to 100 characters. The minimum accepted length is 12 characters."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'@iWD9x4j^_UM7}Qd46NV[@-dz^qD/i^qSnzP\"yg#eOLy7\\'|emw/Y>ZCDt3GiDi\\'.M7$2zxv&r\\'m>GO_EZ&dlY?OMw9JvjL`4%E>>'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate_password(length=100)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Simplifying It"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next, he experiments with the `include_symbols` and `include_numbers` arguments. He sets both to false, overriding the default settings. This gives him a password with only letters: removing symbols and numbers"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'cHaJeZNKwGrh'"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate_password(include_symbols=False, include_numbers=False)"
]
}
],
"metadata": {
Expand Down
1 change: 0 additions & 1 deletion src/passwordler/generate_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ def generate_password(length=12, include_symbols=True, include_numbers=True):
random.shuffle(password_characters)

final_password = ''.join(password_characters)
print(f'Your password is: {final_password}')
return final_password

0 comments on commit 1ff7aaa

Please sign in to comment.