Conditions | 1 |
Paths | 1 |
Total Lines | 6 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | public function encrypt($plainText, $key) { |
||
7 | $method = "AES-256-GCM"; |
||
8 | $initVector = openssl_random_pseudo_bytes(16); |
||
9 | $openMode = openssl_encrypt( $plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag ); |
||
10 | |||
11 | return bin2hex( $initVector ).bin2hex( $openMode . $tag ); |
||
12 | } |
||
24 | } |