i want to convert hashed database password converted to simple text.

in database we have like that
$S$D/gNAQpXH4cApq3D25NBt/1BC/YSo/rt9LOxbfN1nfW3L0gRAUfL
$S$DyNYW0j8GmBLYCVFMGhhV2FCnM9RTPfHwtgpNpuRdknbJkGNZuOu
$S$Difag.rmYtALcHcG3au2rjnl01baasgvc2/iy5pATTBWO/G0SP8Y

but i want to print it in page.tpl or in any block as a simple text..
i have done the encryption well.....but in decryption i need ideas to do that. please help me to fix it.

Thanks

Comments

John_B’s picture

Basically you cannot http://stackoverflow.com/questions/13621391/how-can-i-decrypt-sha-512-ha...

though it is said these password hashes will give way to brute force attack sometimes.

Drupal is designed to be secure.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

ashish.verma85’s picture

Hi john i read this.
So what is the best way to authenticate or check database username and password from outside drupa,
means from a PHP page.

I am writing a code in php page, where i have a password variable already encrypted to sha512 and username.

Now i want to validate that with drupal users table with "name" and "pass" but it give me different hash each time so its not possible to compare password, do you have any other idea in the mind?

Thanks
Ashish

John_B’s picture

Shared signon is outside my expertise. There are many authentication options for different situations, and you might start by study the options listed here https://groups.drupal.org/node/182004

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

ashish.verma85’s picture

John thanks again,
We don't need SSO here, we only need to send the data back to the third party site, like, success or fail....

the web service i created working fine with non hash password. it just not working with drupal7 hash pwd.

OK, do you know how can i compare two drupal 7 passwords?
ex
comparing this
$S$D/unrY4bfIXFZW2VaMC76JCr9sc2759fKCmd1zl4jvTUntRICu4p

with
$S$D/unrY4bfIXFZW2VaMC76JCr9sc2759fKCmd1zl4jvTUntRICu4p
or
rS$D/unrY4bfIXFZW2VaMC76JCr9sc2759fKCmd1zl4jvTUntRICu40

if they are equal or not?

that will solve my issue.

Thanks
Ashish

John_B’s picture

I think yes, but I never did it, so I guess you need to try. Maybe someone with experience of this will jump in and give better advice than I can.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

ashish.verma85’s picture

Solved it.

UnsettlingTrend’s picture

Care to tell?

Jaypan’s picture

Hashing is a one-way process. Hashed passwords cannot be converted back to unhashed passwords (this is by design).

What you have to do is hash a submitted password using the same process as Drupal, then check if the hashed password is the same as the one saved in the database.

ashish.verma85’s picture

hi

Hashing is a one-way process, so what i did, i compared two passwords using drupal functions, if you need then i can share the code.

Thanks

Julien55’s picture

Hi,

Can you post the code please? I have the same problem and i am really lost.
Thank you

ashish.verma85’s picture

Hi, sorry i dont have the access of the source code anymore, but you can easily compare it using the existing drupal functions.

Julien55’s picture

Hi, Where can i find the function who encrypt the password? Thanks

John_B’s picture

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

Shreya Shetty’s picture

https://www.drupal.org/node/1556488 . You can reset your password.