mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-21 20:34:57 +09:00
Box_Password class created as a wrapper of password_* functions
This commit is contained in:
1 parent
f7356cf1ad
commit
bd96543709
1 file changed
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* BoxBilling
|
||||
*
|
||||
* @copyright BoxBilling, Inc (http://www.boxbilling.com)
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* Copyright BoxBilling, Inc
|
||||
* This source file is subject to the Apache-2.0 License that is bundled
|
||||
* with this source code in the file LICENSE
|
||||
*/
|
||||
|
||||
class Box_Password {
|
||||
|
||||
private $algo = PASSWORD_DEFAULT;
|
||||
private $options = array();
|
||||
|
||||
public function setAlgo ($algo)
|
||||
{
|
||||
$this->algo = $algo;
|
||||
}
|
||||
|
||||
public function setOptions($options = array())
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function hashIt($password)
|
||||
{
|
||||
return password_hash($password, $this->algo, $this->options);
|
||||
}
|
||||
|
||||
public function verify ($password, $hash)
|
||||
{
|
||||
return password_verify((string) $password, $hash);
|
||||
}
|
||||
|
||||
public function needsRehash($hash)
|
||||
{
|
||||
return password_needs_rehash($hash, $this->algo, $this->options);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user