| Conditions | 5 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public static function generate($algorithm = 'HMAC-SHA1') |
||
| 28 | { |
||
| 29 | $data = microtime() . mt_rand(); |
||
| 30 | $key = time(); |
||
| 31 | |||
| 32 | if (Algorithm::validate($algorithm)) { |
||
| 33 | list($function, $algorithm) = Algorithm::map($algorithm); |
||
| 34 | |||
| 35 | switch ($function) { |
||
| 36 | case 'HMAC': |
||
| 37 | return Hmac::hash($algorithm, $data, $key); |
||
| 38 | case 'hash_hmac': |
||
| 39 | return hash_hmac($algorithm, $data, $key); |
||
| 40 | case 'openssl': |
||
| 41 | return openssl_sign($data, $signature, $key, $algorithm); |
||
| 42 | } |
||
| 45 | } |