Lines Matching defs:algo
68 $magic = ['algo' => $m[1], 'iter' => $m[2]];
72 $magic = ['algo' => $m[1], 'iter' => $m[2]];
399 * @param string $algo The hash algorithm to be used
407 protected function stretched_hash($algo, $clear, $salt = null, $magic = 'P', $compute = 8)
426 $hash = hash($algo, $salt . $clear, true);
428 $hash = hash($algo, $hash . $clear, true);
557 * database. It has to be converted to a php algo name.
564 * @param array $opts ('algo' => hash algorithm, 'iter' => iterations)
566 * @throws Exception when PHP is missing support for the method/algo
571 if (empty($opts['algo'])) {
574 $prefixalgo = $opts['algo'];
576 $algo = strtolower($prefixalgo);
585 if (!in_array($algo, hash_algos())) {
586 throw new Exception("This PHP installation has no $algo support");
589 $hash = hash_pbkdf2($algo, $clear, hex2bin($salt), $iter, 0);
601 * @param array $opts ('algo' => hash algorithm, 'iter' => iterations)
603 * @throws \Exception when PHP is missing support for the method/algo
608 if (empty($opts['algo'])) {
609 $algo = 'sha256';
611 $algo = $opts['algo'];
621 if (!in_array($algo, hash_algos())) {
622 throw new \Exception("This PHP installation has no $algo support");
625 $hash = base64_encode(hash_pbkdf2($algo, $clear, $salt, $iter, 0, true));
626 return "pbkdf2_$algo\$$iter\$$salt\$$hash";
636 * @throws \Exception when PHP is missing support for the method/algo
640 $opts['algo'] = 'sha256';
651 * @throws \Exception when PHP is missing support for the method/algo
655 $opts['algo'] = 'sha1';
830 * @param string $algo Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4",
837 public static function hmac($algo, $data, $key, $raw_output = false)
841 return hash_hmac($algo, $data, $key, $raw_output);
844 $algo = strtolower($algo);
845 $pack = 'H' . strlen($algo('test'));
851 $key = str_pad(pack($pack, $algo($key)), $size, chr(0x00));
863 $output = $algo($opad . pack($pack, $algo($ipad . $data)));