Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

password protected mysql entries with php

Status
Not open for further replies.

farley99

MIS
Feb 12, 2003
413
US
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: TANSTAAFL!
 
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: TANSTAAFL!
 
Oops, I meant the [tt]ENCODE[/tt] and [tt]DECODE[/tt] functions. [blush] //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top