| @@ 75-82 (lines=8) @@ | ||
| 72 | * @return string |
|
| 73 | * @throws \Exception |
|
| 74 | */ |
|
| 75 | public function encrypt(string $data): string |
|
| 76 | {
|
|
| 77 | foreach ($this->stack as $s) {
|
|
| 78 | $data = OpensslStatic::encrypt($data, $this->passkey, $s[0], $s[1], $this->cost); |
|
| 79 | } |
|
| 80 | ||
| 81 | return $data; |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * Decrypt data using custom stack |
|
| @@ 91-98 (lines=8) @@ | ||
| 88 | * @return string |
|
| 89 | * @throws \Exception |
|
| 90 | */ |
|
| 91 | public function decrypt(string $data): string |
|
| 92 | {
|
|
| 93 | foreach (\array_reverse($this->stack) as $s) {
|
|
| 94 | $data = OpensslStatic::decrypt($data, $this->passkey, $s[0], $s[1], $this->cost); |
|
| 95 | } |
|
| 96 | ||
| 97 | return $data; |
|
| 98 | } |
|
| 99 | } |
|