I need to hash a password in java script.i google it for days and find some articles but i could not understand the point. can any one help me up on this please??
-
Search for a SHA256 implementation for Javascript, and call the SHA256() function on your password.Sjoerd– Sjoerd2011-11-24 07:55:48 +00:00Commented Nov 24, 2011 at 7:55
-
1Do you really need hashing? Wouldn't you be better of by encrypting your connection with SSL/https?yunzen– yunzen2011-11-24 08:05:26 +00:00Commented Nov 24, 2011 at 8:05
Add a comment
|
3 Answers
Javascript doesn't have a native function to hash strings.
http://pajhome.org.uk/crypt/md5/md5.html is a function someone has written to produce an md5.
Copy the code from here http://pajhome.org.uk/crypt/md5/md5.html into your javascript, then run hex_md5(s) where s is the text you want hashed.
Comments
You can use remakes of PHP's md5() and sha1() functions in javascript.