0

Suppose I entered ABC as password; its hash is like $S$DNcgO9.CUWosQrms0/CqWvLIUFikmoczZ42n9bL6wxiH1OhIQbd5, which is stored in the user table. I need to retrieve the plain password.

How can I achieve this?

  • 3
    No you cant convert a hashed password. Unless you have to implement some complex password cracker tools which is not ideal to have. What is your goal to make the password readable? – Gulok Aug 17 '16 at 8:49
  • i want to give all users of their password. so that they can login through their entered password. – Kadambini Das Aug 17 '16 at 8:56
3

The short answer is you cannot. Drupal is using a SHA-512 which is a cryptographic hash function. SHA-512 is one way which means it is not possible to get the original data back.

You can check this api. https://api.drupal.org/api/drupal/includes%21password.inc/function/user_check_password/7.x and this https://api.drupal.org/api/drupal/includes%21password.inc/function/user_hash_password/7.x.

|improve this answer|||||
0

You cannot get the password from its hash, if not by brute force. That is why the hash is saved in the database: Even if somebody would be able to read the database content, they would not get any password from the database.

There isn't any need to give the user their password; if they forgot their password, Drupal has a way to let them set a new one, which is done by sending an email with a link.

Directly disclosing passwords from the site is a bad idea. Are you sure the user asking for the password is the legitimate person, and not somebody that is trying to get access to somebody else's account?

|improve this answer|||||
0

To how many users do you want to give their passwords? If you have very less users on your site, then you can reset password for each user from admin panel (from edit user page) and send updated password to each user.

You will not get password from the database as password are saved using SHA-512 (cryptographic hash function).

|improve this answer|||||
  • There are 50,000 of users in my sites – Kadambini Das Aug 17 '16 at 10:05
  • You can loop through all the 50,00 users and update their password pragmatically. While updating passwords, save them in temporary table for each user and then send an email to each with their updated password. – Hiraman Patil Aug 17 '16 at 10:31
0

You can reset the password and sent email about new password to the users.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.