Net/Notifier/WebSocket/Frame.php
protected function mask($data)
    {
        $out    = '';
        $length = mb_strlen($data, '8bit');
        $j      = ($this->cursor - $this->headerLength) % 4;

        for ($i = 0; $i < $length; $i++) {
            $data_octet = $this->getChar($data, $i);
            $mask_octet = $this->getChar($this->mask, $j);
            $out .= pack('C', ($data_octet ^ $mask_octet));
            $j++;
            if ($j >= 4) {
                $j = 0;
            }
        }

        return $out;
    }
protected function mask($data)
    {
        $out    = '';
        $length = mb_strlen($data, '8bit');
        $j      = ($this->cursor - $this->headerLength) % 4;

        for ($i = 0; $i < $length; $i++) {
            $data_octet = $this->getChar($data, $i);
            $mask_octet = $this->getChar($this->mask, $j);
            $out .= pack('C', ($data_octet ^ $mask_octet));
            $j++;
            if ($j >= 4) {
                $j = 0;
            }
        }

        return $out;
    }
protected function mask ( $ data ) { $ out = '' ; $ length = mb_strlen ( $ data , '8bit' ) ; $ j = ( $ this -> cursor - $ this -> headerLength ) % 4 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ data_octet = $ this -> getChar ( $ data , $ i ) ; $ mask_octet = $ this -> getChar ( $ this -> mask , $ j ) ; $ out .= pack ( 'C' , ( $ data_octet ^ $ mask_octet ) ) ; $ j ++ ; if ( $ j >= 4 ) { $ j = 0 ; } } return $ out ; }
Masks data according the the algorithm described in RFC 6455 Section 5.3

@param string $data a binary string containing the data to mask.

@return string a binary string containing the the masked data.
Masks data according the the algorithm described in RFC 6455 Section 5 . 3