• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Encryption Service has strange characters

#1
Hello everyone

Using the Encryption library, the result of the '$encrypter->encrypt('This is a plain-text message!')', returns strange characters like this: 



[C�<��ɪ�˓T��H- 9t�g噾��B7��/���d� ��Ɲ�'�y`�@��@��L�$��[�M����D�?Ʃ�h�zt�%�M\ �hС����B!�)�



 is that correct?

I'm using version 4.0.2 stable

Thanks
Reply

#2
That looks like binary data to me. Haven't looked in the code, but I don't see any reason it would not be valid.

You can save it as is in binary form in the database or base64 encode it. But then you need to base64 decode it before decryptning it.
Reply

#3
(03-02-2020, 11:27 AM)jreklund Wrote: That looks like binary data to me. Haven't looked in the code, but I don't see any reason it would not be valid.

You can save it as is in binary form in the database or base64 encode it. But then you need to base64 decode it before decryptning it.


Cool, using base64_encode / decode I can pass the coded value to the url, thanks.
Reply

#4
Hi, I just recommended the wrong function yesterday... You should use bin2hex and hex2bin.
https://www.php.net/manual/en/function.bin2hex.php
https://www.php.net/manual/en/function.hex2bin.php
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.