Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
please can someone replicate this javascript function in c#

JavaScript
function login(form)
{
	form['md5'].value = hex_hmac_md5(form['username'].value, hex_md5(form['password'].value) );
	form['password'].value = '';
	return true;
}


What I have tried:

I have tried converting to md5 using my own methods.
Posted
Updated 5-Apr-16 12:26pm
v2
Comments
phil.o 5-Apr-16 12:05pm    
What is wrong with a simple md5 c# search?
Member 11273642 5-Apr-16 12:17pm    
it seems there is some method "hex_hmac_md5" that takes two parameters i dont know about.
phil.o 5-Apr-16 12:22pm    
HMACMD5 Class
You should start from here; always start with the documentation.
Sergey Alexandrovich Kryukov 5-Apr-16 12:06pm    
First of all, why using broken MD5? What's the problem? .NET MD5, as many other cryptography stuff, is a part of official FCL...
—SA
Richard Deeming 19-Apr-16 11:24am    
This is an extremely bad idea.

You store hashed passwords in the database because you don't want an attacker who compromises your database to be able to read your users' passwords.

But by hashing the password on the client, and sending only the hashed password to the server, you have effectively undone that. Now, an attacker who has access to your database doesn't need to reverse the password hash, because the password hash is the password.

Sure, they can't get the original password and try it on other sites, so you're doing very slightly better than storing passwords in plain text. But they can still authenticate to your site as any user they want, without having to break your password hashing.

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