Does anyone have a simple example where i can insert PASSWORD to a mysql database encrypted and then decrypt it an read it in a file? when i try to call it back it give me the encrypted password instead of the real one.
All of the encryption functions built into MySQL, such as password(), encrypt(), and mds(), are use one-way hashing algorithms. Once information is encrypted with these functions, there is no way to decrypt them.
Do you have the mcrypt libraries installed and available to PHP? You can then perform encryption using reversible algorithms on the PHP side. Want the best answers? Ask the best questions:
Actually, MySQL's [tt]ENCRYPT[/tt] and [tt]DECRYPT[/tt] functions can be used for these purposes. I've used them before on a site where I had to be able to fetch the password. //Daniel
Odd. The MySQL online manual says that encrypt() uses the Unix crypt() function, if available -- that function uses a one-way algorithm. It doesn't even mention a decrypt() function.
It does mention the aes_encrypt()/aes_decrypt() and des_encrypt()/des_decrypt() function pairs, though. Want the best answers? Ask the best questions:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.