Send password safely using an ajax request

前端 未结 4 1210
执念已碎
执念已碎 2020-12-30 18:01

just to know, is it possible to send password through an Ajax request safely?

I\'ve a login box that calls an ajax request to try the login/pass and retrieve a JSON

4条回答
  •  北海茫月
    2020-12-30 18:32

    Here's what you could do:

    Hash Password and store in database

    On client side: hash password, then add salt (concatenate session_id string), then hash again

    On server: take hashed pw from database, then add salt (concatenate session_id string), then hash again

    [Edit: and then compare the hash-salt-hash generated on the server with the one sent from the client]

    Intercepting your hash-salt-hash password is quite useless now, because it is only valid for that particular session...

提交回复
热议问题