md5加密客户端 [英] md5 encryption client side

查看:74
本文介绍了md5加密客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用这个encryption.js文件并加密来自客户端的密码。我希望在服务器端获得加密的txtpassword。我可以在设计页面编写javascript函数吗?

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:TextBox runat="server" ID="txtPassword" TextMode="Password" ></asp:TextBox>





encription.js文件:

http://www.queness.com/code-snippet/6523/generate-md5-hash-with-javascript



encription.js file:
http://www.queness.com/code-snippet/6523/generate-md5-hash-with-javascript

推荐答案

您不能使用MD5,因为它是加密哈希函数 [ ^ ],一种特殊的单向函数 [ ^ ]。散列函数应该用于存储密码的散列(而不是明文),但操作不可逆(同样,MD5易受攻击,不得用于安全功能)。确保密码和其他机密的安全传输的最简单方法是强制执行HTTPS。
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.


您需要查看其他地方,或重新考虑您在做什么:MD5不是加密算法 - 它是一种哈希算法。



区别在于加密可以逆转(所以你可以在服务器端恢复你的文本),Hashing不能 - 你不能得到从输出值返回的原始输入。



这里使用加密的整个想法无论如何都有缺陷:它要求服务器将加密密钥作为一部分发送给客户端网页。



我们使用哈希算法,是 - 但是将它与数据库中的哈希值进行比较,不要试图复活原始输入。并且不要使用MD5 - 多年来它已被破坏。改为使用SHA2。
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.


这篇关于md5加密客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆