Board index   FAQ   Search  
Register  Login
Board index php forum :: PHP and MySQL Security PHP & MySQL Security

MySQL Encryption

Security issues related to php and mysql usage. How to make your code secure? Security measures and configurations? It's all in here!

Moderators: macek, egami, gesf

MySQL Encryption

Postby wesleyss22 » Sun Nov 06, 2011 3:50 am

Hi guys

Just a curious question, I have created a site for the company I work for, I have no PHP experience, just got into it, the site is functional, able to create and view posts by calling pages using submit button which calls pages with the actual code in them. But to the point, I currently only encrypt the password of registered users using md5, but I want to encrypt their posts as well, is there a way I can do this, I know md5 only allows one way encryption and validates a password by comparing md5 strings. So is there a way?

Thanks in advance for any response at all.
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Nov 06, 2011 3:36 am

Re: MySQL Encryption

Postby L33R » Sat Jan 21, 2012 12:34 pm

hi there,

I found this on another site. I hope it helps

Code: Select all
   $key = 'password';
   $string = ' string to be encrypted ';
   echo $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
   echo $decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "\0");

User avatar
New php-forum User
New php-forum User
Posts: 133
Joined: Fri Dec 30, 2011 4:27 am
Location: Liverpool

Return to PHP & MySQL Security

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.