Commit | Line | Data |
---|---|---|
14d4f286 S |
1 | <?php |
2 | /** | |
3 | * An abstract implementation of some standard key derivation needs | |
4 | * | |
5 | * PHP version 5.3 | |
6 | * | |
7 | * @category PHPCryptLib | |
8 | * @package Key | |
9 | * @subpackage Derivation | |
10 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
11 | * @copyright 2011 The Authors | |
12 | * @license http://www.opensource.org/licenses/mit-license.html MIT License | |
13 | * @version Build @@version@@ | |
14 | */ | |
15 | ||
16 | namespace CryptLib\Key\Derivation; | |
17 | ||
18 | /** | |
19 | * An abstract implementation of some standard key derivation needs | |
20 | * | |
21 | * @category PHPCryptLib | |
22 | * @package Key | |
23 | * @subpackage Derivation | |
24 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
25 | */ | |
26 | abstract class AbstractDerivation { | |
27 | ||
28 | /** | |
29 | * @var Hash A hashing algorithm to use for the derivation | |
30 | */ | |
31 | protected $hash = null; | |
32 | ||
33 | /** | |
34 | * @var array An array of options for the key derivation function | |
35 | */ | |
36 | protected $options = array( | |
37 | 'hash' => 'sha512', | |
38 | ); | |
39 | ||
40 | /** | |
41 | * Construct the derivation instance | |
42 | * | |
43 | * @param array $options An array of options to set for this instance | |
44 | * | |
45 | * @return void | |
46 | */ | |
47 | public function __construct(array $options = array()) { | |
48 | $this->options = $options + $this->options; | |
49 | $this->hash = $this->options['hash']; | |
50 | } | |
51 | ||
52 | } |