Gets the users id for a given hash and type.

@param string $hash
@param int $type

@return int | false
510019
public static function getUserID($hash, $type)
    {
        self::removeExpired($type);
        $db = Database::connection();
        $uID = $db->fetchColumn("SELECT uID FROM UserValidationHashes WHERE uHash = ? AND type = ?", array($hash, $type));
        if (is_numeric($uID) && $uID > 0) {
            return $uID;
        } else {
            return false;
        }
    }
727886
private function getHash($mixed)
    {
        if ($mixed instanceof File) {
            $mixed = pathinfo($mixed->getHashName(), PATHINFO_EXTENSION);
        }

        return $this->container->get('claroline.utilities.misc')->generateGuid().'.'.$mixed;
    }
869119
public static function verify($password, $hash): int
    {
        // Fail if hash doesn't match
        if (!$password || !$hash || !password_verify($password, $hash)) {
            return 0;
        }

        // Otherwise check if hash needs an update.
        return password_needs_rehash($hash, PASSWORD_DEFAULT) ? 2 : 1;
    }
694897
public function decode($hash, $type = '')
    {
        if (strlen($hash) !== 11) {
            return false;
        }

        if (!isset($this->_keys[$type])) {
            if ($this->_key === null) {
                $this->_key = $this->crypt->getDerivedKey('secint');
            }

            $this->_keys[$type] = md5($this->_key . $type, true);
        }

        $r = unpack('Vid/Vr', mcrypt_decrypt(MCRYPT_XTEA, $this->_keys[$type], base64_decode($hash . '='), MCRYPT_MODE_ECB));

        if ($r['r'] & 0xFFFF) {
            return false;
        } else {
            return $r['id'];
        }
    }
176742
public function scandir($hash) {
		if (($dir = $this->dir($hash)) == false) {
			return false;
		}
		
		return $dir['read']
			? $this->getScandir($this->decode($hash))
			: $this->setError(elFinder::ERROR_PERM_DENIED);
	}
711851
private static function hash($assignment, $userid, $attemptnumber) {
        if (is_object($assignment)) {
            $assignmentid = $assignment->get_instance()->id;
        } else {
            $assignmentid = $assignment;
        }
        return sha1($assignmentid . '_' . $userid . '_' . $attemptnumber);
    }
164330
public function loadUserByToken($hash)
    {
        $query = $this->handler->createSelectQuery();
        $query->select(
            $this->handler->quoteColumn('contentobject_id', 'ezuser'),
            $this->handler->quoteColumn('login', 'ezuser'),
            $this->handler->quoteColumn('email', 'ezuser'),
            $this->handler->quoteColumn('password_hash', 'ezuser'),
            $this->handler->quoteColumn('password_hash_type', 'ezuser'),
            $this->handler->quoteColumn('is_enabled', 'ezuser_setting'),
            $this->handler->quoteColumn('max_login', 'ezuser_setting')
        )->from(
            $this->handler->quoteTable('ezuser')
        )->leftJoin(
            $this->handler->quoteTable('ezuser_setting'),
            $query->expr->eq(
                $this->handler->quoteColumn('user_id', 'ezuser_setting'),
                $this->handler->quoteColumn('contentobject_id', 'ezuser')
            )
        )->leftJoin(
            $this->handler->quoteTable('ezuser_accountkey'),
            $query->expr->eq(
                $this->handler->quoteColumn('user_id', 'ezuser_accountkey'),
                $this->handler->quoteColumn('contentobject_id', 'ezuser')
            )
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->handler->quoteColumn('hash_key', 'ezuser_accountkey'),
                    $query->bindValue($hash, null, \PDO::PARAM_STR)
                ),
                $query->expr->gte(
                    $this->handler->quoteColumn('time', 'ezuser_accountkey'),
                    $query->bindValue(time(), null, \PDO::PARAM_INT)
                )
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
974100
public static function getInstance($type, $init)
    {

        if (!self::$cachingInstance) {
            self::$cachingInstance = new IDS_Caching_Database($type, $init);
        }
        return self::$cachingInstance;
    }
1356199
public function urlHash($hash = null, $withHash = true)
    {
        if ($hash) {
            $this->set('urlHash', ltrim($hash, '#'));
        }

        $hash = $this->get('urlHash', '');

        return $withHash && !empty($hash) ? '#' . $hash : $hash;
    }
459266
public function getInfo($hash) {
    $regex_pattern = '/^\$[a-z, 1-6]{1,6}\$/i';
    preg_match($regex_pattern, $hash, $matches);

    if(sizeof($matches) > 0) {
      list($method) = $matches;
    } else {
      $method = null;
    }

    switch($method) {
      case self::SHA256:
      case self::SHA512:
      case self::PBKDF2:
        $param = array();
        list( , , $params) = explode('$', $hash);
        parse_str($params, $param);
        $info['options'] = $param;
      break;

      case self::BCRYPT;
        list( , , $cost) = explode('$', $hash);
        $info['options'] = array(
          'cost' => $cost,
        );
      break;
    }
    $info['algo'] = $method;
    return $info;
  }
142535
public function getInfoByHash($hash)
       {
            $index = array_search($hash, $this->map, true);
            if (false !== $index) {
                return $this->getInfoByKey($index);
            }
       }
71179
static function passwordHashTypeID( $identifier )
    {
        switch ( $identifier )
        {
            case 'empty':
            {
                return self::PASSWORD_HASH_EMPTY;
            } break;
            case 'md5_password':
            {
                return self::PASSWORD_HASH_MD5_PASSWORD;
            } break;
            case 'md5_user':
            {
                return self::PASSWORD_HASH_MD5_USER;
            } break;
            case 'md5_site':
            {
                return self::PASSWORD_HASH_MD5_SITE;
            } break;
            case 'mysql':
            {
                return self::PASSWORD_HASH_MYSQL;
            } break;
            case 'plaintext':
            {
                return self::PASSWORD_HASH_PLAINTEXT;
            } break;
            case 'bcrypt':
            {
                return self::PASSWORD_HASH_BCRYPT;
            } break;
            case 'php_default':
            {
                return self::PASSWORD_HASH_PHP_DEFAULT;
            } break;
            default:
            {
                eZDebug::writeError( "Password hash type identifier '$identifier' is not recognized. " .
                                     'Check the site.ini [UserSettings] HashType setting. ' .
                                     'Defaulting to ' . self::passwordHashTypeName( self::DEFAULT_PASSWORD_HASH ) );
                return self::DEFAULT_PASSWORD_HASH;
            }
        }
    }
411770
public function getTypesWithCount() {
		$query = $this->find();
		$types = $query
			->select(['type', 'count' => 'COUNT(*)'])
			->distinct('type')
			->order('type ASC')
			->disableHydration()
			->toArray();

		return Hash::combine($types, '{n}.type', '{n}.count');
	}
256450
public function findAllByRegisteraddresshash($hash)
    {
        $query = $this->createQuery();

        $query->matching(
            $query->equals('registeraddresshash', $hash )
        );

        return $query->execute();
    }
1037905
public function needsPasswordRehash($hash) {
		$PasswordHasher = $this->_getPasswordHasher($this->_config['passwordHasher']);
		if (!method_exists($PasswordHasher, 'needsRehash')) {
			return false;
		}
		return $PasswordHasher->needsRehash($hash);
	}
1181672
public function getDataFromHash($hash)
	{
		$data   = [];
		$fields = $this->fields[$hash];
		foreach ($fields as $source => $ids)
		{
			$result  = [];
			$results = $this->results[$source];
			foreach ($ids as $id)
			{
				$result[$id] = $results[$id];
			}
			$data[$source] = $result;
		}

		return $data;
	}
596789
public function retrieve ($hash)
    {
        $cached = $this->memcached->get($this->prefix . $hash);

        if ($this->memcached->getResultCode() === \Memcached::RES_SUCCESS) {
            $json = json_decode($cached, true);

            if (isset($json['token'], $json['expires'])) {
                return new AccessToken($json['token'], DateTime::createFromFormat('U', $json['expires']));
            }
        }
    }