Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dees040/newhash
Class for genrerating new hashes
https://github.com/dees040/newhash
Last synced: about 4 hours ago
JSON representation
Class for genrerating new hashes
- Host: GitHub
- URL: https://github.com/dees040/newhash
- Owner: dees040
- Created: 2015-03-07T11:29:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-10T17:51:13.000Z (over 9 years ago)
- Last Synced: 2023-08-21T02:45:13.546Z (about 1 year ago)
- Language: PHP
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NewHash
This class can be used to check if a password needs to be rehashed.
Usage
=====**Require the class**
```
require_once 'NewHash.php';
```**Set settings**
```
Hash::set(['oldHash' => MD5, 'newHash' => SHA256]);
```**Check password**
```
Hash::check('user_input', 'password');
```Documentation
=============**Settings options**
- oldHash: the old hash that your script currently is using. This could be MD5, SHA1, SHA256, SHA384, SHA512, SHA256. Default: MD5.
- newHash: the new hash you want to use. This could be MD5, SHA1, SHA256, SHA384, SHA512, RIPEMD128. Default: SHA256
- connection (REQUIRED): A PDO instance of the database connection. Default: creates a custom connection.
- userTable: The user table in the database. Default: 'users'.
**Check passwords**- ```$userInput``` ('user_input'): The user input info, this can be an: id, email or username.
- ```$password``` ('password): The user password which has been filled in on the login form.
- ```return```: Returns user credentials on success and false on failure/user not found.
Database
========The user table needs to have five columns.
1. id, INT AI
2. username, VARCHAR()
3. password, VARCHAR(128)
4. salt, VARCHAR(15)
5. email, VARCHAR()TODO
====1. Specify database connection settings. With this you don't need to set a PDO connection, you can just specify the database credentials en the code will create a new PDO object for you.
2. Just hash a password. This function just will hash a password, so you don't need to check it. This can be used on user registration.
3. Add beter documenation.