The purpose of the Diffie-Hellman protocol is to enable two users to exchange a secret key securely that can then be used for subsequent encryption of messages. The protocol itself is limited to exchange of the keys. But because of having no entity authentication mechanism, Diffie-Hellman protocol is easily attacked by the man-in-the-middle attack and impersonation attack in practice. In this paper, we compare the computational efficiency of various authentication methods. Finally an improved key exchange schema based on hash function is given, which improves the security and practicality of Diffie-Hellman protocol.