Skip to content
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

updated decfun documentation #64

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 72 additions & 7 deletions docs/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
{
"data": {
"text/plain": [
"'2CG2=>Bz[<Kh'"
"',tKC]m\"wDJ34'"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -165,7 +165,7 @@
{
"data": {
"text/plain": [
"'^r-8Wl9j5Zpea@pwYB83#D/>Sp`o^x5,m&K7\\\\,MV,CUd!$Zi`SCU6y>A/K^FnS.cQLP:c&>A59z0t7y)@9xK(>\".I7iN$X?d$LE6'"
"\"],rDfnF}g0K'{X9Nc;&&z![54=rB/eEiTkH$^c80_522>!:-*F?(N8w_Bv]J:q-2A&V:SzQNCR6Yk>/Z|,iL)pg/^1aZVhMv!ndI\""
]
},
"execution_count": 5,
Expand Down Expand Up @@ -199,7 +199,7 @@
{
"data": {
"text/plain": [
"'ozcuYALomeYA'"
"'NJfVKhgnrJYa'"
]
},
"execution_count": 6,
Expand Down Expand Up @@ -254,7 +254,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"What he didn’t know is that by not providing a seed, the default seed of 123 is used. Then he read the docs and figured out a random seed parameter controls the shuffled character mapping."
"What he didn’t know is that by not providing a seed, the default seed of 123 is used. Then he reads the docs and figured out a random seed parameter controls the shuffled character mapping."
]
},
{
Expand All @@ -263,7 +263,7 @@
"source": [
"#### Going for a customized seed\n",
"\n",
"Then Bob felt it might be better to customize the seed, so he picked up a random number he liked as the seed (better not a lucky number or DOB the others can easily guess). This means that he needs to store the seed and the encrypted password in two different places, but as long as it is a unique seed, the encrypted password is in the safe house.\n",
"Then Bob felt it might be better to customize the seed, so he picked up a random number he liked as the seed (better not a lucky number or the date of birth that others can easily guess). This means that he needs to store the seed and the encrypted password in two different places, but as long as it is a unique seed, the encrypted password is in the safe house.\n",
"So Bob passes a seed as a second argument:"
]
},
Expand All @@ -285,13 +285,78 @@
"encrypted_password = encrypt_password(\"Baseball4life!\", 42428)\n",
"print(encrypted_password) # Prints the encrypted password using the specified seed"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Decrypt a Password\n",
"#### First try: default setting\n",
"The next time Bob tries to log in to facebook, he can't remember his password. But Bob knows where he has saved his encrypted password. He cannot find the seed,so he tries to decrypt his encrypted password with the default settings:"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'I3:-!3vvnväk-5'"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from passwordler.decrypt_password import decrypt_password\n",
"decrypt_password(encrypted_password)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Customized Seed\n",
"That does not look like his original password. So Bob has to search his computer to find his seed. Fortunately, he finds the seed and tries to decrypt his password again:"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Baseball4life!'"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"decrypt_password(encrypted_password, 42428)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Yeah! That is the original password! With the help of Passwordler, Bob is now protected against any embarrassing future mishaps. "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:passwordler]",
"display_name": "passwordler",
"language": "python",
"name": "conda-env-passwordler-py"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading