Skip to content

anghelmihai/ZHash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Classes for dealing with password hashing and authenticating the users. There are 2 classes : ZHash_Password for hashing the password and ZHash_Auth_Adapter_Db which extends Zend_Auth_Adapter_Db and this one can be used only with Zend Framework

ZHash_Password usage is pretty simple, for example:

$obj = new ZHash_Password(array('algorithm' => 'sha512', 'iterations' => 20000, 'key' => 'mypass'));
$hash = $obj->hashKey()->getHash();

The hashing is done using the crypt function from php : crypt . For information on why you shouldn't store passwords in the database using just sha1 or md5 with a static salt(or without) please see here How to manage a PHP application's users and passwords and this webinar Strong Cryptography in PHP

The usual Zend_Auth_Adapter_Db can't be used with passwords that are generated like this so I created the ZHash_Auth_Adapter_Db which can be used exactly like the parent class with the some small exceptions.If you set the credential treatment than don't use the ? character.The reason is that the user can't be retrieved in a single query, first it searches for the username and after that it checks the password.Also, you should set a dummy salt corresponding to the algorithm and number of iterations you use in your application.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages