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

New php-forum User
New php-forum User
Posts: 1
Joined: Sun Nov 06, 2011 3:36 am

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.

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

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");

Return to “PHP & MySQL Security”

Who is online

Users browsing this forum: No registered users and 2 guests