|
1 |
| -# pypasswords |
2 |
| -Easy working with passwords in python |
| 1 | +# Pypasswords - work with passwords easily. |
| 2 | + |
| 3 | +Pypasswords provides easy hashing, checking and generating passwords for you. |
| 4 | + |
| 5 | +# Overview |
| 6 | + |
| 7 | + - Hash passwords using your favourite hashing algorithms |
| 8 | + - Check passwords for strength or validity |
| 9 | + - Generate passwords with your own parameters |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +To install this package you can use Pypi via pip |
| 14 | + |
| 15 | +``` |
| 16 | +$ pip install pypasswords |
| 17 | +``` |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +First you need to import all methods from this package |
| 22 | + |
| 23 | +```py |
| 24 | +from pypasswords import hash_it, check_it, generate_it |
| 25 | +``` |
| 26 | +... or simply |
| 27 | + |
| 28 | +```py |
| 29 | +from pypasswords import * |
| 30 | +``` |
| 31 | + |
| 32 | +#### Hashing |
| 33 | + |
| 34 | +You can easily hash your password with just one line of code: |
| 35 | + |
| 36 | +```py |
| 37 | +hash_it('qwerty') |
| 38 | +``` |
| 39 | + |
| 40 | +**hash_it** method has the following parameters: |
| 41 | +* **password** - (string) |
| 42 | +* **hash_type** - (string). *Optional*. Use to specify hashing algorithm. Default: *sha-256* |
| 43 | +* **salting** - (bool). *Optional*. Use to specify whether to use salt or not. More [here](https://en.wikipedia.org/wiki/Salt_(cryptography)). Default: *False*. Warning: if you specify salt=*True* then the method will generate random salt and return both the hash and the salt. |
| 44 | +* **static_salt** - (string). *Optional*. Use to specify your own salt. |
| 45 | +* **salt_length** - (int). *Optional*. Use to specify the length of the salt. Default: *6* |
| 46 | +* **local_parameter** - (string). *Optional*. Use to specify local parameter. More [here](https://www.openwall.com/presentations/YaC2012-Password-Hashing-At-Scale/mgp00005.html). |
| 47 | + |
| 48 | +##### Examples: |
| 49 | + |
| 50 | +```py |
| 51 | +hash_it('qwerty', hash_type='sha512') |
| 52 | +hash_it('qwerty', salting=True, static_salt='some_word') |
| 53 | +hash_it('qwerty', salting=True, salt_length=10, local_parameter='word') |
| 54 | +``` |
| 55 | + |
| 56 | +#### Checking |
| 57 | + |
| 58 | +You can check your password for strength or validity: |
| 59 | + |
| 60 | +```py |
| 61 | +check_it('qwerty') |
| 62 | +``` |
| 63 | + |
| 64 | +**check_it** method has the following parameters: |
| 65 | +* **password** - (string) |
| 66 | +* **check_type** - (string). *Optional*. There are 2 check types: strength and valid. Default: *strength* |
| 67 | + - *strength* check type will return number 0-100 indicating strength of your password. If strength more than 30 then the password is good.If strength more than 50 then the password is strong. |
| 68 | + - *valid* check type will return True or False whether password has 'stop chars' or not. You have to specify *stop_chars* to use this check type. |
| 69 | +* **stop_chars** - (string). *Optional*. Use to specify stop characters to check your password for validity. |
| 70 | + |
| 71 | +##### Examples: |
| 72 | + |
| 73 | +```py |
| 74 | +check_it('123some-password321') |
| 75 | +check_it('qwerty', check_type='valid', stop_chars='0123456789') |
| 76 | +``` |
| 77 | + |
| 78 | +#### Generating |
| 79 | + |
| 80 | +You can generate password with your own parameters: |
| 81 | + |
| 82 | +```py |
| 83 | +generate_it() |
| 84 | +``` |
| 85 | + |
| 86 | +**generate_it** method has the following parameters: |
| 87 | +* **strength** - (int). *Optional*. Defalut: *2* |
| 88 | + - **1** - *low*. Using letters only. |
| 89 | + - **2** - *medium*. Using letters and numbers. |
| 90 | + - **3** - *high*. Using letters, numbers and symbols. |
| 91 | +* **length** - (int). *Optional*. Use to specify password length. Default: *12* |
| 92 | + |
| 93 | +##### Examples: |
| 94 | + |
| 95 | +```py |
| 96 | +generate_it(strength=2) |
| 97 | +generate_it(strength=3, length=3) |
| 98 | +``` |
| 99 | + |
| 100 | +License |
| 101 | +---- |
| 102 | + |
| 103 | +MIT |
| 104 | + |
| 105 | +# |
| 106 | +Pypasswords uses one open source package to work properly: |
| 107 | + |
| 108 | +* [zxcvbn](https://github.com/dropbox/zxcvbn) - password strength estimator |
| 109 | + |
| 110 | +And of course **pypasswords** itself is open source with a [public repository](https://github.com/CosmoSt4r/pypasswords) |
| 111 | + on GitHub. |
0 commit comments