| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public static function encrypt(string $input, string $key): string |
||
| 19 | { |
||
| 20 | list($cipher, $iv_size) = self::getCipher(); |
||
| 21 | $iv = substr($key, 0, $iv_size); |
||
| 22 | $key = substr($key, 0, $iv_size); |
||
| 23 | |||
| 24 | mcrypt_generic_init($cipher, $key, $iv); |
||
| 25 | |||
| 26 | $data = mcrypt_generic($cipher, $input); |
||
| 27 | $data = str_replace("certplus", "\\+", str_replace("(\r\n|\n)", "", $data)); |
||
| 28 | |||
| 29 | self::finalizeCipher($cipher); |
||
| 30 | |||
| 31 | return base64_encode($data); |
||
| 32 | } |
||
| 33 | } |
||
| 34 |