| Conditions | 5 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public static function generate($algorithm = 'HMAC-SHA1') |
||
| 35 | { |
||
| 36 | $data = microtime() . mt_rand(); |
||
| 37 | $key = time(); |
||
| 38 | |||
| 39 | if (Algorithm::validate($algorithm)) { |
||
| 40 | list($function, $algorithm) = Algorithm::map($algorithm); |
||
| 41 | |||
| 42 | switch ($function) { |
||
| 43 | case 'HMAC': |
||
| 44 | return Hmac::hash($algorithm, $data, $key); |
||
| 45 | case 'hash_hmac': |
||
| 46 | return hash_hmac($algorithm, $data, $key); |
||
| 47 | case 'openssl': |
||
| 48 | return openssl_sign($data, $signature, $key, $algorithm); |
||
| 49 | } |
||
| 52 | } |