Yet Another Hash package is a simple package to generate hash for string
That will be secure enough to be used for keeping track of user password or other
sensitive information.The generated hash has no default method to reverse it...The
generated hash has a max length of 32 characters just as a md5() hash but is more secure than
a simple md5 or sha1.An optional cost can be specified to make the hash more difficult to
be cracked one day.The hashmore class also take as parameter an array reference that will contains
in the output the timestamp salt value at index one and a shuffle value of this timestamp at the index two.
The only way to check a hash value is to used this array and the exact cost of the hashmore class
used to generate the hash...
How to use:
$x=new Hashmore(new Hashids());
$e=$x->secretstr('leizmo@gmail.com','',10,$ti); or $e=$x->secretstr('first string here','other string here',10,$ti);
//$ti will then contains as said above the specific timestamp to use to check after if the passed string is the same
// you will need this array but also the cost here 10
//just as:
$f=$x->secretstr('leizmo@gmail.com','',10,$ti); or $f=$x->secretstr('first string here','other string here',10,$ti);
//then
if($f==$e) 'echo you are welcome';
else echo 'get out here .....';
Note:First time you use the last parameter(&$time) you don't need to specify a value but you can specify a boolean value or a specific
float value and even an array.A boolean value will be considered as if you have used time() or microtime() function .A float value
will be taken as if you specify a specific timestamp.In the two cases a new hash string will be generated.
You can see some basic test in the testHashmore.php...
Finally you must be aware that the package has as dependency hashids/hashids that you can simply install with composer(composer require hashids/hashids)
or manually by downloading it at https://github.com/ivanakimov/hashids.php.git and install it
You can also globally install dependencies and autoloader by simply use composer with update command.
Please report bug and other at leizmo@gmail.com or use the forum to do it...
|