Which function to encrypt / decrypt password

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Thu Nov 01, 2012 1:59 am



Code: Select all

$hashed_password = crypt('mypassword'); // let the salt be automatically generated

if (crypt($user_input, $hashed_password) == $hashed_password) {
   echo "Password verified!";

User avatar
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Fri Nov 02, 2012 9:32 am

md5 may also work for you.


php-forum Fan User
php-forum Fan User
Posts: 974
Joined: Mon Oct 01, 2012 12:32 pm

Fri Nov 02, 2012 2:10 pm

Why does everyone want to be able to reverse passwords? One way encryption is all that is necessary, because there is never ever ever EVER a reason that you need to know another user's password. All you do by trying to have that functionality is set yourself up to be in a position of liability in the event that your data is compromised because of your insecure practices.

Post Reply