By putting "Encrypt string in Javascript" into your friendly neighbourhood Google I got Loads of results on how to do this. It took me all of about 10 seconds.
Then I looked at some of the results, it's how you learn how to do things.
I cam across this:
A use full looking link[
^]
I highly suggest you go and read it.
I also suggest you learn how to google topics before asking for help, in addition read the FAQ on this site on how to ask questions.