Encryption produces gibberish string |
$this->config = new \Config\Encryption();
$this->encrypter = \Config\Services::encrypter($this->config); $ciphertext = $this->encrypter->encrypt(base64_encode($text)); When I echo $ciphertext, I get some gibberish text(see below). Ideally, I am saving this value in the database. Is this normal? �wD�yL��'T�Z��Oq�J��H1�b���~��x��q���a��A=�8���d�/�Ȍ�$�T����"��F�����Ѝ��5%�T;" Quote:You’ll notice that the createKey() method outputs binary data, which is hard to deal with (i.e., a copy-paste may damage it), so you may use bin2hex(), or base64_encode to work with the key in a more friendly manner. https://www.codeigniter.com/user_guide/l...or-results I think you have the base64_encode in the wrong place. (02-07-2021, 03:53 AM)craig Wrote:Quote:You’ll notice that the createKey() method outputs binary data, which is hard to deal with (i.e., a copy-paste may damage it), so you may use bin2hex(), or base64_encode to work with the key in a more friendly manner. |
Welcome Guest, Not a member yet? Register Sign In |