1 | <?php |
||
4 | class Encrypter |
||
5 | { |
||
6 | const BLOCK_SIZE = 16; |
||
7 | const KEY_SIZE = 32; |
||
8 | |||
9 | protected $generator; |
||
10 | protected $key; |
||
11 | |||
12 | 3 | public static function generateKey() |
|
16 | |||
17 | 15 | public function __construct($key) |
|
25 | |||
26 | /** |
||
27 | * @return string |
||
28 | */ |
||
29 | 3 | public function decrypt($value, $nonce) |
|
34 | |||
35 | 3 | public function encrypt($value, $nonce) |
|
40 | |||
41 | 6 | public function generateNonce() |
|
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | 3 | public function getKey() |
|
53 | |||
54 | 3 | protected function addPadding($value) |
|
61 | |||
62 | 6 | protected function getRandomizer() |
|
75 | |||
76 | 3 | protected function isPaddingValid($pad, $value) |
|
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | 3 | protected function stripPadding($value) |
|
90 | } |
||
91 |