Revision 1932
Added by darkviper almost 11 years ago
PasswordHash.php | ||
---|---|---|
26 | 26 |
* requirements (there can be none), but merely suggestions. |
27 | 27 |
*/ |
28 | 28 |
|
29 |
class PasswordHash { |
|
29 |
class PasswordHash implements PasswordHashInterface {
|
|
30 | 30 |
protected $itoa64; |
31 | 31 |
protected $itoa64BlowFish; |
32 | 32 |
protected $random_state; |
33 |
protected $iteration_count_log2; |
|
34 |
protected $portable_hashes; |
|
35 | 33 |
|
34 |
public $iteration_count_log2; |
|
35 |
public $portable_hashes; |
|
36 |
|
|
36 | 37 |
public function __construct($iteration_count_log2, $portable_hashes) |
37 | 38 |
{ |
38 | 39 |
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
... | ... | |
48 | 49 |
$this->random_state .= getmypid(); |
49 | 50 |
} |
50 | 51 |
} |
52 |
/** Begin inserted function for WebsiteBaker by M.v.d.Decken **/ |
|
53 |
/** |
|
54 |
* Interface compatibility methode to set values |
|
55 |
* @param int $iIterations number of iterations |
|
56 |
* @param bool $bHashType type of encoding |
|
57 |
*/ |
|
58 |
public function setParams($iIterations, $bHashType){ |
|
59 |
$this->iteration_count_log2 = $iIterations; |
|
60 |
$this->portable_hashes = $bHashType; |
|
61 |
} |
|
62 |
/** End inserted function for WebsiteBaker by M.v.d.Decken **/ |
|
51 | 63 |
|
52 | 64 |
private function get_random_bytes($count) |
53 | 65 |
{ |
... | ... | |
145 | 157 |
$output .= $this->encode64($input, 3); |
146 | 158 |
return $output; |
147 | 159 |
} |
148 |
/** Begin inserted function for WebsiteBaker by W.v.d.Decken **/
|
|
160 |
/** Begin inserted function for WebsiteBaker by M.v.d.Decken **/
|
|
149 | 161 |
/** |
150 | 162 |
* |
151 | 163 |
* @param type $input |
Also available in: Unified diff
modified class Password for use with different hashing classes