I have an issue using DES_DECRYPT
& DES_ENCRYPT
in MySQL.
When I run the following select clause in phpmyadmin
SELECT DES_DECRYPT(DES_ENCRYPT('mytext','mypassword'),'mypassword');
It returns
DES_DECRYPT(DES_ENCRYPT('mytext','mypassword'),'mypassword') 6d7974657874
Normally it should return mytext again, right?
When I run it inside php, it works like a charm. Anyone knows what I did wrong here ?
Works fine here:
mysql> select des_decrypt(des_encrypt('foo', 'bar'), 'bar');
+-----------------------------------------------+
| des_decrypt(des_encrypt('foo', 'bar'), 'bar') |
+-----------------------------------------------+
| foo |
+-----------------------------------------------+
1 row in set (0.00 sec)
Which version of MySQL are you using, and how are you running the query/displaying the results?
All right I have the answer, thanks Marc B. This is just an option in php myadmin. See screenshot: http://s2.postimg.org/iatjf29fd/des_DECRYPT.png
Thanks for the support !!