I am writing a multiplayer game. I have a central server which processes everything. For data exchange I use HTTPS protocol. Because this is a game I cannot use computationally expensive systems like RSA for data transfer.
To login,
- Client uses sha512 to produce hexadecimal hash from password and random
seed
. - Client sends "login" request with username, hash and
seed
to the server. - Server checks if user has not attempted too many login requests and checks whether the password hash matches the hash made from the password in the database. If it does, it sends an
access_key
and a response that login was successful
To send requests which require login,
- Client sends a hash generated from the
access_key
andseed
along with the request data. - Server checks whether the IP has not changed and whether the hash made from
access_key
andseed
is correct. If it is, newaccess_key
is generated from the old one, request data is processed and the server returns the newaccess_key
along with the response from the request.
At any time, if client's IP changes or invalid access_key
is sent, the session is automatically terminated.
How secure is this approach? What can I do to improve it?