/** * Configures the client ID * * We hash the client ID to prevent leakage of information if another client * happens to get a hold of an ID. The secret *must* be lengthy, and must * be kept secret for this to work: otherwise it's trivial to search the space * of possible IP addresses/ports (well, if not trivial, at least very fast). */ protected function configureClientId() { $message = sprintf('%s:uri=%s&ip=%s&port=%s', $this->options['connection_id_secret'], rawurlencode($this->manager->getUri()), rawurlencode($this->ip), rawurlencode($this->port)); $algo = $this->options['connection_id_algo']; if (extension_loaded('gmp')) { $hash = hash($algo, $message); $hash = gmp_strval(gmp_init('0x' . $hash, 16), 62); } else { // @codeCoverageIgnoreStart $hash = hash($algo, $message); // @codeCoverageIgnoreEnd } $this->id = $hash; }