Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 74 | | All time: 10,213 This week: 206 |
|
Description | | Author |
This class can generate and check passwords using a salted hash.
It takes a given password text and generates a hash using a random salt string value.
The class can also check a previously generated hash matches the hash of a given password using the same salt string value. | |
|
|
Innovation award
Nominee: 1x |
|
Example
<?php
require 'OneHashSaltedPassword.class.php';
$a = new OneHashSaltedPassword('testkey');
$pw = $a->GenerateSaltedPassword('test'); //we generating a new hash for the password "test"
echo $pw . '<hr>';
var_dump($a->CheckPassword('test',$pw)); //we pretend someone typed in the correct passoword. Retuns bool(ture)
var_dump($a->CheckPassword('test2',$pw)); //we pretend someone typed in the wrong password. Returns bool(false)
?>
|
Details
OneHashSaltedPassword
This class is for generate and check password hashes that actually contains the salt too.
The idea:
This way in the database you can store a single hash value in the password column while
it is salted properly so even at the same password you will see different hash values.
Also if an attacker steals only your user database they will assume you store your password
in plain sha256, not knowing it is actually a combination of a password and a salt, making
their work harder.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.