function _pad($text)
    {
        $length = strlen($text);

        if (!$this->padding) {
            if ($length % $this->block_size == 0) {
                return $text;
            } else {
                user_error("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})");
                $this->padding = true;
            }
        }

        $pad = $this->block_size - ($length % $this->block_size);

        return str_pad($text, $length + $pad, chr($pad));
    }
function _pad($text)
    {
        $length = strlen($text);

        if (!$this->padding) {
            if ($length % $this->block_size == 0) {
                return $text;
            } else {
                user_error("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})");
                $this->padding = true;
            }
        }

        $pad = $this->block_size - ($length % $this->block_size);

        return str_pad($text, $length + $pad, chr($pad));
    }
function _pad ( $ text ) { $ length = strlen ( $ text ) ; if ( ! $ this -> padding ) { if ( $ length % $ this -> block_size == 0 ) { return $ text ; } else { user_error ( "The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})" ) ; $ this -> padding = true ; } } $ pad = $ this -> block_size - ( $ length % $ this -> block_size ) ; return str_pad ( $ text , $ length + $ pad , chr ( $ pad ) ) ; }
Pads a string

Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize.
$this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to
chr($this->block_size - (strlen($text) % $this->block_size)

If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless
and padding will, hence forth, be enabled.

@see self::_unpad()
@param string $text
@access private
@return string
Pads a string