protected function initBufferEncryption($data, $key)
    {
        $data   = (binary) $data;
        $header = $this->buildHeader();
        $nonce  = new Buffer(24);
        $nonce->write((string) $header, 0);

        $data = \Sodium\crypto_secretbox($data, (string) $nonce, $key);

        $this->buffer = new Buffer(strlen((string) $header) + strlen($data));
        $this->buffer->write((string) $header, 0);
        $this->buffer->write($data, 12);
    }
protected function initBufferEncryption($data, $key)
    {
        $data   = (binary) $data;
        $header = $this->buildHeader();
        $nonce  = new Buffer(24);
        $nonce->write((string) $header, 0);

        $data = \Sodium\crypto_secretbox($data, (string) $nonce, $key);

        $this->buffer = new Buffer(strlen((string) $header) + strlen($data));
        $this->buffer->write((string) $header, 0);
        $this->buffer->write($data, 12);
    }
protected function initBufferEncryption ( $ data , $ key ) { $ data = ( binary ) $ data ; $ header = $ this -> buildHeader ( ) ; $ nonce = new Buffer ( 24 ) ; $ nonce -> write ( ( string ) $ header , 0 ) ; $ data = \ Sodium \ crypto_secretbox ( $ data , ( string ) $ nonce , $ key ) ; $ this -> buffer = new Buffer ( strlen ( ( string ) $ header ) + strlen ( $ data ) ) ; $ this -> buffer -> write ( ( string ) $ header , 0 ) ; $ this -> buffer -> write ( $ data , 12 ) ; }
Initilizes the buffer with encryption.

@param string $data The Opus data to encode.
@param string $key  The encryption key.

@return void
Initilizes the buffer with encryption .