Re: MySQL ENCRYPT help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kevin the Linux User wrote:
To the PHP Database Mailing-List:

I joined the mailing list for this one question I just can't figure out.

nice, we help you and then you bugger off? - community spirit are go!

I used the phpMyAdmin to create table. I placed one row in this table, I used the ENCRYPT function. How do I De-Crypt the data I just encrypted to use in my PHP code. I encrypted it, for security.

	If it's not a bother, can you also give a sniplet of example code, on just the part of de-crypting it, I know everything about connecting, and displaying, it's just the de-crypting I am having trouble with.


the mysql manual states:

"ENCRYPT() ignores all but the first eight characters of str, at least on some systems. "


this is probably not what you want, besides which AFAICS its one way encryption.


---

as you don't state what it is your trying to achieve (e.g. storing a passwd - in which there is NO reason to want to decrypt it - instead you should test a user given value against the DB by encrypting the user value), you also don't state what version of MySQL your using therefore its impossible to determine which encryption functions you have at your disposal in MySQL.

here is a couple of pairs of enc/dec funcs that might help:

AES_ENCRYPT(str,key_str)
AES_DECRYPT(crypt_str,key_str)

DECODE(crypt_str,pass_str)
ENCODE(str,pass_str)

try reading this page:
http://dev.mysql.com/doc/mysql/en/Encryption_functions.html

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux