how to encrypt username and password before transmit on client side

I want to encrypt the username and password at client side when user login to my page first and then send to server.Could anybody tell me how to do it?Thanks a lot.
[185 byte] By [a_wavea] at [2007-10-2 11:31:02]
# 1
Do not encrypt at the client side using any client side scripting language or even applets since the logic and the keys that are used will be visible to the world.if you need encription use ssl and let the protocole handle the encryption
LRMKa at 2007-7-13 4:53:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
ya, thats true. Don't encrypt using our own encryption tool. SSL could be a better option. go for that
_R@mes.ha at 2007-7-13 4:53:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Yup , What suggested is true...

The HTTPs authentication type is mainly for encrypting..

This is an extract from the book i have which states how you can do that...

UNDERSTANDING AUTHENTICATION MECHANISMS

HTTPS Client authentication :

HTTPS is HTTP over SSL (Secure Socket Layer). SSL is a protocol developed by

Netscape to ensure the privacy of sensitive data transmitted over the Internet. In this

mechanism, authentication is performed when the SSL connection is established

between the browser and the server. All the data is transmitted in the encrypted form

using public-key cryptography, which is handled by the browser and the servlet container

in a manner that is transparent to the servlet developers. The exam doesn抰

require you to know the details of this mechanism.

Advantages

The advantages of HTTPS Client authentication are

?It is the most secure of the four types.

?All the commonly used browsers support it.

1 Actually, instead of the password, an MD5 digest of the password is sent. Please refer to RFC 1321 for

more information.

Disadvantages

The disadvantages of HTTPS Client authentication are

?It requires a certificate from a certification authority, such as VeriSign.

?It is costly to implement and maintain.

YogendraJ123a at 2007-7-13 4:53:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...