0

I have used below code to encrypt the parameter. But it will generate the encrypted string with slashes.

How to deal with the special character in mcrypt? Some special character not works in url like slash.

//For encryption

$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
    $parcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->crypt_key, "VALUE_TO_ENCRYPT", MCRYPT_MODE_ECB, $iv);
    $encode = base64_encode($parcrypt );

Thanks.

Sachin
  • 1,273
  • 5
  • 16
  • 27
  • mcrypt creates a byte sequence, not a string. It is Base64 encoding of that sequence which is string and which can contain slash characters. – Oleg Estekhin Jul 01 '14 at 13:13
  • Ohh, byte sequence. But I don't want the slashes in that because when I use this in url it will not work. – Sachin Jul 01 '14 at 13:15
  • Can you choose [one](http://stackoverflow.com/questions/1374753/passing-base64-encoded-strings-in-url) of [these](http://stackoverflow.com/questions/1412391/what-character-replacements-should-be-performed-to-make-base-64-encoding-url-saf) [questions](http://stackoverflow.com/questions/6102077/possible-characters-base64-url-safe-function) yourself and mark your question as a duplicate? Basically you need a url-safe variaon of Base64. – Oleg Estekhin Jul 01 '14 at 13:16
  • I closed it as a duplicate. @OlegEstekhin – Scott Arciszewski Nov 02 '19 at 00:43

0 Answers0