Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, i want using this encryption.js file and encrypt password from client side.i want get encrypted txtpassword on server side.how can i write javascript function in design page?
ASP.NET
<asp:TextBox runat="server" ID="txtPassword" TextMode="Password" ></asp:TextBox>


encription.js file:
http://www.queness.com/code-snippet/6523/generate-md5-hash-with-javascript
Posted
Updated 7-Aug-13 2:21am
v3

You can't with MD5 since it's a cryptographic hash function[^], a particular kind of one-way function[^]. Hash functions should be used to store hashes of passwords (rather than clear text) but the operation is not reversible (also, MD5 is vulnerable to attacks and must not be used for security features). The simplest way of ensuring secure transmissions of passwords and other secrets is to enforce HTTPS.
 
Share this answer
 
You need to look elsewhere, or re-think what you are doing: MD5 is not an encryption algorithm - it is a Hashing algorithm.

The difference is that Encryption can be reversed (so you can get your text back on the server side), Hashing cannot - you cannot get the original input back from the output value.

The whole idea of using encryption here is flawed anyway: it requires that the server sends the encryption key to the client as part of the web page.

Us a hashing algorithm, yes - but compare it against the hashed value in your database, do not attempt to "resurrect" the original input. And don't use MD5 - it's been "broken" for years. Use SHA2 instead.
 
Share this answer
 
Comments
mit62 7-Aug-13 9:24am    
thanks. i should use linked algorithm(http://www.queness.com/code-snippet/6523/generate-md5-hash-with-javascript ). I don't want get original input on serverside but i want use the hash value and compare it with the value in database.i dont know how hash password before send it to serverside

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900