The process will look like this: -
The server generates a call and sends it to the client. e.g. X
At the client
passwordHashed = Hash (password) challengeHashClient = Encryption (X, passwordHashed) // passwordHashed is the key
send a hashclient call to the server.
On server
get password from database challengeHashServer = Encryption (X, with password)
HashServer with HashClient
There should also be a timeout for this operation to prevent a re-attack.
However, if you are using a Windows environment, why not consider using authentication in Kerberos Windows?
source share