Page 1 of 1

Calculating the MySQL 5 password hash

Posted: Mon 20 Nov 2006 20:55
by ajasja
Hello!

Part of my application will have to manage a large number of users.
Therefore passwords will often change. I wouldn’t like the plain text passwords to get saved in any query-logs, therefore I'd like to hash the new passwords before I send them.

Right now I'm using SELECT PASSWORD('mypassword') which kind of defeats the whole point.
Is there any other way (a Pascal procedure) to get the password hash returned by PASSWORD()?

Best regards,
Ajasja Ljubetič

Posted: Tue 21 Nov 2006 12:14
by Antaeus
This question does not concern MyDAC. Try to ask it the forum on MySQL AB site. You should know that encrypting password only is not enough for safe working because the traffic between the client and the server can can be intercepted in any moment. To achieve a high level of data protection you should use SSH Tunneling or SSL.

Posted: Tue 21 Nov 2006 12:33
by ajasja
It does concern MyDAC. Perhaps I wasn't specific enough, but the question was weather MyDAC already has (exposes) such a function.
(Similar to the make_scrambled_password() C API function).
I guess the answer is no.

Well, anyway, I found out (after some serious searching) that the PASSWORD() is just a double SHA-1 hash, so it's not hard to implement.

Thank you for ypur answer & best regards,
Ajasja

Posted: Tue 21 Nov 2006 12:45
by Antaeus
You are right. MyDAC does not have such possibility.