Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | public static function token($data, $method, $key) |
||
8 | { |
||
9 | $iv_strlen = 2 * Bytes::iv($method); |
||
10 | if (preg_match('/^(.{'.$iv_strlen.'})(.+)$/', $data, $regs)) { |
||
11 | list(, $iv, $crypted_string) = $regs; |
||
12 | if (ctype_xdigit($iv) && mb_strlen($iv) % 2 == 0) { |
||
13 | return openssl_decrypt($crypted_string, $method, $key, 0, hex2bin($iv)); |
||
14 | } |
||
15 | } |
||
16 | |||
17 | return false; // failed to decrypt |
||
18 | } |
||
20 |