Calculating the MySQL 5 password hash

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ajasja
Posts: 7
Joined: Sun 29 Oct 2006 09:46

Calculating the MySQL 5 password hash

Post by ajasja » Mon 20 Nov 2006 20:55

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č

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 21 Nov 2006 12:14

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.

ajasja
Posts: 7
Joined: Sun 29 Oct 2006 09:46

Post by ajasja » Tue 21 Nov 2006 12:33

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 21 Nov 2006 12:45

You are right. MyDAC does not have such possibility.

Post Reply