public function encrypt($string)
    {
        $td = mcrypt_module_open($this->cypher, '', $this->mode, '');
        $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), mcrypt_RAND);
        mcrypt_generic_init($td, $this->key, $iv);
        $encrypted = mcrypt_generic($td, $string);
        mcrypt_generic_deinit($td);

        return $iv.$encrypted;
    }